Skip to main content

Retrieving data Using Select statement

Basic Rules for writing SQL Statement.
–- SQL statements are not case-sensitive.
–- SQL statements can be entered on one or more lines.
–- Keywords cannot be abbreviated or split across lines.
–- Clauses are usually placed on separate lines.
–- Indents are used to enhance readability
Selection vs Projection
Projection
Selecting Columns from table without where clause
Selection
Selecting rows from table using where clause condition
Query to see list of all table from database
Select *from tab;
Viewing all column from table

Query:

select *from employees;

g1
Viewing specific column from table

Query:

select First_name, last_name from employees;

g2
Giving alias name to column
Query:

SELECT first_name, salary "monthly salary" FROM employees


g3
Using concatenation operator in Select statement
Query:

 SELECT first_name || last_name FROM employees


g4
Display Unique value from column
Query:

 SELECT distinct department_id from employees
g5