Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

SQL_Revision (2)

The document provides an overview of SQL commands and their usage in various database systems like MySQL and Oracle. It explains Data Definition Language (DDL) for structuring data and Data Manipulation Language (DML) for modifying data, including commands to create databases and tables, insert, update, delete, and select records. Examples of SQL commands for managing an 'Employee' table are also included, demonstrating how to perform various operations on the data.

Uploaded by

vedant.rathi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

SQL_Revision (2)

The document provides an overview of SQL commands and their usage in various database systems like MySQL and Oracle. It explains Data Definition Language (DDL) for structuring data and Data Manipulation Language (DML) for modifying data, including commands to create databases and tables, insert, update, delete, and select records. Examples of SQL commands for managing an 'Employee' table are also included, demonstrating how to perform various operations on the data.

Uploaded by

vedant.rathi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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;

You might also like