We have already seen the very basics of SELECT command. Basically it is used to retrieve the data from the database. We can retrieve only selected categories or subset of data from one or more tables or views or materialized views. It either pulls the entire data from the table/view or pulls specific records based on the condition.
The basic SELECT command is
SELECT * FROM table_name;-- retrieves all the rows and columns from table table_name and displays it in tabular form.
SELECT COLUMN1, COLUMN2, COLUMN3 FROM table_name;-- retrieves only 3 columns from table table_name
SELECT t1.COLUMN1, t2.COLUMN1
FROM table_name1 t1, table_name2 t2
WHERE t1.COLUMN2 = t2.COLUMN2;--Combines2 tables and retrieves specific columns from both the tables.
Some examples of SELECT:
SELECT * FROMSTUDENT; -- All the columns are retrieved and displayed in below format
SELECTSTUDENT_NAME, ADDRESSFROMSTUDENT; -- Retrieves only name and address from STUDENT table