SQL: Structured Query Language-Commands
MySQL/MS Access/SQLite3/Oracle: Database-
Tables-Rows/Columns
DDL: Data Definition Language
DML: Data Manipulation Language
DDL: Structure of the data
DML: Modifications in the table
DDL: Create, Alter , Drop
DML: Insert, Delete, Update, Select
Create Database:
create database company;
Open database company:
use company;
Create table Employee:
create table employee(EmpID integer primary
key not null,Name varchar(30),DOB date, DeptID
varchar(10), Desig varchar(30),Salary integer);
Insert values in table employee:
insert into employee values(120,”Alisha”,’1978-
01-23’,”D001”,”Manager”,75000);
SQL commands:
(i)modify the salary of empid 120 with 80000
Ans.
update employee set salary=80000 where
empID=120;
(ii)delete the record with empID 130
Ans.
delete from employee where empId=130;
(iii)to display the contents of the table employee
Ans.
select * from employee;
(iv)to display the contents of employees whose
salary is more than 50000.
Ans.
select * from employee where salary>50000;
(v)to display empId and salary of manager
Ans.
select empId, salary where desig=”Manager”;
(vi)display the contents of table and arrange the
salary in ascending order(asc for ascending and
desc for desecding)
Ans.
select * from employee order by salary asc;
(vi)to delete entire contents of the table
Ans.
delete from employee;
(vii) to delete table from database
Ans.
drop table employee;