Choosing columns · בחירת עמודות
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.
בחירת עמודות
SELECT * מחזיר כל העמודות. בדרך כלל תרצה רק מספר מעט. במקום *, ציין את העמודות הרצויות, מופרדות בפסיקים:
SELECT name, score FROM student;
התוצאה תכלול רק את העמודות האלו, בסדר שכתבת אותן.
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.
שינוי שם עמודה באמצעות AS
ניתן לשנות שם של עמודה בתוצאה באמצעות AS. הדבר אינו משנה את הטבלה—רק את הכותרת המוצגת:
SELECT name AS pupil, score AS mark FROM student;
הכותרות יהפכו לpupil ולmark. זה שימושי לדוחות ברורים.
Common mistakes
- List the columns you want, separated by commas.
ASrenames a column in the result.
טעויות נפוצות
- ציין את העמודות הרצויות, מופרדות בפסיקים.
ASמשנה שם של עמודה בתוצאה.
SELECT picks columns · SELECT בוחר עמודות
Choosing columns keeps only the fields you name. · בחירת עמודות שומרת רק את השדות שציינתם.
Select only the name and score columns from student, in that order. · בחרו רק את עמודות הname והscore מטבלת student, בסדר זה.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.
Select name and score, but rename the headings to pupil and mark using AS. · בחרו את הname והscore, אך שינו את הכותרות לpupil ולmark באמצעות AS.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.