Select Query in SQL
Select query is used to retrieve the database from RDBMS databases. RDBMS stores data in form of tables.
Rows and column format. You have selection the data from table with where clause which will return specific data according to condition present in where clause. For projection the data you have to specify the column name instead of * mark in select query to get specific column of data.
Syntax:
SELECT COL1, COL2, COL3, MAX(COL4) FROM TABLE_NAME
WHERE COL1 = VAL1 AND COL2 = VAL2
GROUP BY COL1, COL2, COL3
HAVING COL1 > 10
Syntax
-Select all data from table
select columnname from table_name;
-- Select selection data
select * from table_name where column_name=value;
--select projection data
select col_name1,col_name2 from table_name;
--For both selection and projection
select col_name1,col_name2 from table_name where col_name3 = value;
Example
Select all columns from the employee table which employee id has value 101.
Select * from employee where employee_id = 101;