0% found this document useful (0 votes)
2 views7 pages

Dbms lab journal

The document is a lab journal for a Database Management System course, detailing various SQL operations such as table creation, data insertion, modification, and deletion. It includes examples of creating 'Customers' and 'Employee' tables, inserting records, altering tables, and executing delete and update commands. The journal is submitted by a student named Khubaib Nasir from Bahria University Islamabad.

Uploaded by

adekookie43
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

Dbms lab journal

The document is a lab journal for a Database Management System course, detailing various SQL operations such as table creation, data insertion, modification, and deletion. It includes examples of creating 'Customers' and 'Employee' tables, inserting records, altering tables, and executing delete and update commands. The journal is submitted by a student named Khubaib Nasir from Bahria University Islamabad.

Uploaded by

adekookie43
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

DATA BASE AND MANAGEMENT

SYSTEM LAB
Lab Journal: 02
SUBMITTED TO: MAM ASIFA

Name: Khubaib Nasir


Class: BSAI4
Enrollment no: 01-136232-067

DEPARTMENT OF COMPUTER
SCIENCE
BAHRIA UNIVERSITY ISLAMABAD
Computer Science Department
Lab Journal 2

Course Title: Database Management System Lab Due Date: 14/02/25

___________________________________________________________________________

Table Creation, Table Definition Modification, Data Insertion and Deletion using your
project ideas. Add screenshots of SQL Statement and output.

CREATE CUSTOMER TABLE:

CREATE TABLE Customers(

FirstName VARCHAR(50),

LastName VARCHAR(50),

Email VARCHAR(100),

DOB DATE,

Phone VARCHAR(20)

);

INSERT INTO Customers (FirstName, LastName, Email, DOB, Phone) VALUES

('Ahmed', 'Khan', '[email protected]', '1985-07-15', '0300 1234567'),

('Sara', 'Shaikh', '[email protected]', '1990-11-25', '0321 7654321'),

('Ali', 'Rehman', '[email protected]', '1992-02-10', '0345 9876543'),

('Fatima', 'Mirza', '[email protected]', '1988-09-30', '0311 6549870 ');


Code 2:

CREATE TABLE EMPLOYEE:

CREATE TABLE Employee (

EmpID INT PRIMARY KEY,

LastName VARCHAR(50),

FirstName VARCHAR(50),

Address VARCHAR(255),

City VARCHAR(50)

);

INSERT INTO Employee (EmpID, LastName, FirstName, Address, City) VALUES

(1, 'Khan', 'Ali', 'House #12, Street 5, G-9', 'Islamabad'),

(2, 'Ahmed', 'Hassan', 'Block C, DHA Phase 6', 'Lahore'),

(3, 'Sheikh', 'Bilal', 'Gulshan-e-Iqbal, Block 10', 'Karachi'),

(4, 'Chaudhry', 'Usman', 'Model Town, Street 14', 'Lahore'),

(5, 'Baloch', 'Zubair', 'Satellite Town, Block A', 'Quetta'),

(6, 'Hussain', 'Raza', 'Shalimar Town, Street 9', 'Rawalpindi'),

(7, 'Javed', 'Ayesha', 'North Nazimabad, Block H', 'Karachi');

ALTER TABLE Employee:


ALTER TABLE Employee

ADD PhoneNumber VARCHAR(15);

TRUNCATE COMMAND:

TRUNCATE TABLE customerso

DROP TABLE Employee;

DROP TABLE Employee;


UPDATE TABLE:

UPDATE Employee

SET Address = 'House #14, Street 6, G-9'

WHERE EmpID = 1;

UPDATE MULTIPLE ROWS:


UPDATE Employee

SET City = 'Faisalabad'

WHERE City = 'Lahore';

DELETE STATEMENT:

DELETE FROM Employee

WHERE EmpID = 7;

DELETE FROM Employee

WHERE EmpID = 7;
DELETE ALL RECORDS:

DELETE FROM Employee;

You might also like