πŸ”Ή SELECT Command

Definition: The SELECT statement is used to fetch data from a database table. It's the most commonly used SQL command.
Syntax:
SELECT column1, column2, ...
FROM table_name;

πŸŽ“ Sample Table: students

idnameagegrade
1Asha15A
2Rohan14B
3Meena16A
SELECT * FROM students;

🟒 Output: Shows all data from the students table.

idnameagegrade
1Asha15A
2Rohan14B
3Meena16A
SELECT name, grade FROM students;

🟒 Output: Only shows name and grade for each student.

namegrade
AshaA
RohanB
MeenaA
πŸ“Œ When to Use SELECT:
Use SELECT when you want to retrieve data from one or more columns in a table. It’s the foundation of all read operations in SQL.
⚠️ Common Mistakes:
  • Using SELECT without FROM β€” causes an error.
  • Missing commas: SELECT name grade instead of SELECT name, grade.
  • Spelling table or column names incorrectly.