SELECT
SELECT statement is used to retrieve data from table in a database.
It is listed as a DML in SQL.
To select and retrieve certain columns from a table, we use following syntax
SELECT column1, column2...
FROM table_name;
If we want to retrieve all data records from a table, we can use the following syntax:
SELECT * FROM table_name;
We will be using the same database we created in our example earlier. Lets just take an example of students table (Table 1) for this section.
Table 1. STUDENTS table
We will be using the same database we created in our example earlier. Lets just take an example of students table for this section.
SELECT * FROM students;
OUTPUT
SELECT student_id, first_name
FROM students;
OUTPUT