SQL Lab Assignment
SQL Lab Assignment
SQL Lab Assignment
Output:-
3. Delete command with WHERE clause
Syntax :- DELETE FROM table_name WHERE condition;
4. ORDER BY CLAUSE
Syntax :- SELECT column1, column2, ...FROM table_name
ORDER BY column1, column2, ... ASC|DESC;
5. Update command
Syntax:- UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Commands:-
6. SELECT DISTINC command
Insert the same multiple values into the address field then use the select distinct
command
Syntax:- SELECT DISTINCT column1, column2, ...
FROM table_name;
Commands:- select DISTINCT Adress from Students;
Output:-
9. LIKE operator
The LIKE operator is used in a WHERE clause to search for a specified pattern in a
column.
Output:-
LEFT JOIN :- The LEFT JOIN keyword returns all records from the left table
(table1), and the matching records from the right table (table2). The result is 0 records
from the right side, if there is no match.
Synatx:- SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;
Command:- select Orders.OrderID,Customers.CustomerName from Orders LEFT JOIN
Customers ON Orders.customerId=Customers.CustomerID;
Ouput:-
RIGHT JOIN :-
The RIGHT JOIN keyword returns all records from the right table
(table2), and the matching records from the left table (table1). The
result is 0 records from the left side, if there is no match .
Output:-
FULL JOIN:- The FULL JOIN keyword returns all records when there is a
match in left (table1) or right (table2) table records.