Choosing columns · Memilih kolom
Picking columns
SELECT * returns every column. Usually you want only a few. Instead of *, list the columns you want, separated by commas:
The result has just those columns, in the order you wrote them.
Memilih Kolom
SELECT * mengembalikan setiap kolom. Biasanya Anda hanya ingin beberapa. Daripada *, daftarkan kolom yang Anda inginkan, dipisahkan oleh koma:
SELECT name, score FROM student;
Hasilnya hanya berisi kolom-kolom tersebut, sesuai urutan penulisan Anda.
Renaming a column with AS
You can rename a column in the result with AS. This does not change the table — only the heading shown:
The headings become pupil and mark. This is handy for clear reports.
Mengganti Nama Kolom dengan AS
Anda dapat mengganti nama kolom di hasil dengan AS. Ini tidak mengubah tabel—hanya judul yang ditampilkan:
SELECT name AS pupil, score AS mark FROM student;
Judul-judul menjadi pupil dan mark. Ini berguna untuk laporan yang jelas.
Common mistakes
- List the columns you want, separated by commas.
ASrenames a column in the result.
Kesalahan Umum
- Daftarkan kolom yang Anda inginkan, dipisahkan oleh koma.
ASrenameda nama kolom di hasil.
SELECT picks columns · SELECT memilih kolom
Choosing columns keeps only the fields you name. · Memilih kolom hanya menyimpan bidang yang Anda sebutkan.
Select only the name and score columns from student, in that order. · Pilih hanya kolom name dan score dari student, dalam urutan itu.
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.
Select name and score, but rename the headings to pupil and mark using AS. · Pilih name dan score, tapi ganti judulnya menjadi pupil dan mark menggunakan AS.
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.