0% found this document useful (0 votes)
59 views4 pages

Submitted To:: Sir Shahid Ali Bhutta

This lab report describes tasks completed for a database management system project. The tasks involve creating tables for Careem captains and cabs with attributes and constraints, populating the tables with data, and writing queries to retrieve information from the tables such as counting cabs by manufacturer, listing cabs and their details, and finding a captain's details based on a cab number.

Uploaded by

malik Arsh
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)
59 views4 pages

Submitted To:: Sir Shahid Ali Bhutta

This lab report describes tasks completed for a database management system project. The tasks involve creating tables for Careem captains and cabs with attributes and constraints, populating the tables with data, and writing queries to retrieve information from the tables such as counting cabs by manufacturer, listing cabs and their details, and finding a captain's details based on a cab number.

Uploaded by

malik Arsh
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/ 4

Lab Report#0

Database Management System

Submitted To:
Sir Shahid Ali Bhutta
Submitted By:
Muhammad Bilal
17-CP-52
Task 1: Generate a table named as Careem_Captain having attributes and
constraints given below.
Careem_Captain.
/*table Careem_Captain*/
create table Careem_Captain
(
Capt_id Bigint primary key not null,
Name Varchar(30) Not null,
Phone Bigint Unique,
); sp_help Careem_Captain;

OUTPUT

Task 2: Populate the above Table

QUERY:

insert into Careem_Captain


values(3210212345671,'Ali',03331234511);
insert into Careem_Captain
values(3240612345672,'Ahmad',03001234522);
insert into Careem_Captain
values(3640612345673,'Mohsin',03211234533);
insert into Careem_Captain
values(3640612345674,'Zaheer',03141234544);
select*from Careem_Captain;
Output:

Task 3: Generate another table named as Careem_Cab having attributes and


constraints given below.

QUERY:
/*table Careem_Cab*/
create table CareemCab
(
Cab_No Varchar(8) primary key not null,
Manufacturer Varchar(10) Not null,
Model Int,
Captain Bigint Foreign key references CareemCaptain(CapT_id),
Constraint checkmodel check (model>2010)
);
sp_help Careem_Cab;

OUTPUT:

Task 4: Populate the above Table


QUERY:
insert into Careem_Cab
values('LEE-4488','Honda',2018,3240612345672);
insert into Careem_Cab
values('MLL-9486','Suzuki',2012,3640612345673);
insert into Careem_Cab
values('DGM-303','Toyota',2015,3640612345674);
insert into Careem_Cab
values('LEC-3206','Suzuki',2016,3240612345672);
OUTPUT:

Task 5: Show the number of Suzuki Manufactured Cabs registered by Careem.


select count(Manufacturer) as Suzukicars
from Careem_cab where Manufacturer='Suzuki';
OUTPUT:

Task. 6. Show the statistics of Cabs registered with Careem w.r.t their
Manufacturers.

QUERY:
select Manufacturer,Cab_No,Model,Captain from Careem_Cab;
OUTPUT:
Task.7. Show details of Careem Captain who owns the cab_no MLL-9486.

QUERY:
select Careem_Captain.Capt_id,Careem_Captain.Name,Careem_Captain.Phone

from Careem_Captain
join Careem_Cab
on Careem_Captain.Capt_id=CareemCab.Captain
where Careem_Cab.Cab_No='MLL-9486'
OUTPUT:

You might also like