Professional Documents
Culture Documents
Features of SQL:-
Ease of use- It is made up of simple English sentences that
convey meaning of the statement clearly. Being interactive in
nature, it allows users to build complex queries easily.
DCL (Data Control Language): These are used to set up the data
base security involving management of user and their privileges .
Data Type in SQL :-
The following data types are supported by the SQL.
Varchar- Values of this data type are variable length character string of
maximum length 2000.
Char-Values of this data type are fixed length character strings of maximum
length 255 characters.
Constraints:-
Check constraint-
Use this constraint when you need to enforce Integrity Rules
that can be evaluated based on a logical Expression. Never use
Check constraints if the constraints can be defined using thee
not null, primary key or foreign Key constraint.
1. Command : create
Purpose: To create table.
Syntax: CREATE TABLE <table name>;
Example: Create table employee.
This command will create the table employee.
2. Command : Insert
Purpose: To insert insert a single or of data into a table.
Syntax: INSERT INFO<table name> VALUES (expression);
Example: Insert into employee values (111,’xyz’, 10);
Eno. =111, Ename=xyz and DeptNo.=10
This command will insert the record in table employee having
Values
3. Command: Update
Purpose: TO update table.
Syntax: UPDATE<tablename> set columnname=expression
Where columnName=expression;
Example: Update employee set DeptNo=20 where Eno.111;
His command will update the value of department No. where
Employee No. equals to 111.
4. Command: Delete
Purpose: To deletes all records from table.
Syntax: DELETE FROM <tablename>;
Example: delete from employee;
This command will delete all the rows of employees table.
5. Command: select
Purpose: to extract data globally.
Syntax: SELECT*FROM<table name>;
Example: select*from employee;
This command will extract all the record from employee tale. We can
Give condition clause to restrict the data extraction according to given
criteria
7. Command : Drop
Purpose: To delete the table table.
Syntax: DROP TABLE <table name>;
Example: Drop table employee;
This command will delete the data of table employee as well as its
description.
8. Command: Order By
Purpose: To change the ascending/descending order of output.
Syntax: SELECT*FROM<table name>ORDER BY<field name>;
Example: select*from employee Order By salary;
This command will show the all records of employee table in
Ascending order.
17
17
16
16
Age
17
16
ENo EName
2 Aman
3 Ritu
EName Basic
Amit 5000
John 6000
Aman 8000
Ritu 8000
(v) Select Ename, Basic from EMP Where Basic Between 5500 and
8000.
EName Basic
Aman 8000
Ritu 8000
John 6000