You are on page 1of 39

ISM FILE

BY-YAJAS BATRA
Create Database
Open Database
Create Tables
i) Persons (P_id, Lname, Fname, Address, Salary, City, D_id, Pj_id)
ii) Dept (D_id, D_name, D_floor)
iii) Project (Pj_id, Pj_name, Pj_duration, Pj_dept, Pj_d_id)
View Table Description using Desc
Persons
View Table Description using Describe
Dept
View Table Description using Describe
Project
Insert Records
i) Persons- 20 records{Using default salary- 1 record}
Insert Records
ii) Dept-
Insert Records
ii) Project-
Primary Key
i) Persons- P_id
Primary Key
ii) Dept- D_id
Primary Key
iii) Project – P_id
Foreign Key
i) D_id in Persons references D_id in Department
Foreign Key
ii) Pj_id in Persons references Pj_id in Project
Alter Table & Chcek constraint
Add gender in Persons after Fname.
Delete column Pj_duration from Project table.
Rename table projects to April_Projects
Show Table Structure
Persons
Update Table
Add details for gender column
Update P_id to 21 for person whose last name is “Bhullar"
View All Records
Persons
View Selective Records using where clause
Display the details of persons whose department id is 1111.
View Selective Fields
Display P_id, Fname & Salary of all persons
Select Distinct
List all the distinct city names from persons.
AND operator
Display the details of persons whose reside is Delhi & whose department id
is 1111.
OR operator
Display the details of persons whose reside is Delhi or whose department id
is 1111.
Order By Clause
Display the details of all the persons in ascending order of their names.
LIKE operator
Display the details of all the persons whose city name contains the pattern
"elh".
LIKE operator
Display the details of all the persons whose second alphabet of the name is
'a'.
LIKE operator
Display the details of all the persons whose lastname starts with 'B' or 'S'.
LIKE operator
Display the details of all the persons whose lastname does not start with 'B','S'
or 'P'.
In Operator
Display the details of all the persons who reside in Delhi, NCR.
Between Operator
Display the details of all the persons whose department id is between 2 to 6.
View List of Databases.
View list of tables in a database
Delete a record
Drop Command
Delete a database

You might also like