×
>
<

Aptitude

SQL DQL Commands

DQL Commands

A SELECT query is used to retrieve data(records) from the table

We can retrieve complete table data, or specific records by specifying conditions using the WHERE clause.

CREATE

Syntax

  
SELECT column1, column2, ...
FROM table_name;
  

Displaying only specific columns using SELECT Query in DBMS

  
SELECT stuid,sname,score 
from student;
  

Display all records present in the table using SELECT Query in DBMS

The ‘*’ operator is used to display all the columns present in the table

  
SELECT * from student;
  
Retrieve records based on some specified condition

Only those records that satisfy the condition specified in the ‘where’ clause are displayed

  
SELECT * from
student
where branch='computers';
  
Performing some calculations on the column using SELECT

We can use simple arithmetic operators upon column data while displaying records

But these changes are not affected in the actual database table they are just used for display purpose

  
SELECT stuid,sname,score,score+5 
from student
where score>80;