Select Query in SQL

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 all data from table
select * 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;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.