├── .gitattributes ├── Lab 3 ├── In Lab#3 Exercise.docx ├── InLab3Practice.sql ├── L19-1021 _ Lab3.sql └── Lab Manual 3 Data Retrieval.docx ├── Lab1-Q1 ├── Lab 1(Q1).pdf ├── Task1(a).aspx └── Task1(b).aspx ├── Lab1_Q2 ├── Lab 1 (Q2).pdf ├── StyleSheet1.css ├── Task2.aspx └── task2.js ├── Lab2.zip └── Lab3.zip /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Lab 3/In Lab#3 Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fazeelkhalid/Database-management-system/f12937423535aae1342004eecec0aee209270c32/Lab 3/In Lab#3 Exercise.docx -------------------------------------------------------------------------------- /Lab 3/InLab3Practice.sql: -------------------------------------------------------------------------------- 1 | Create database inlab3Practice; 2 | 3 | use inlab3Practice; 4 | 5 | create table Students 6 | ( 7 | StudentId int not null primary key, 8 | StudentName varchar(50), 9 | StudentBatch int, 10 | CGPA float 11 | ); 12 | 13 | create table Instructors 14 | ( 15 | InstructorId int not null primary key, 16 | InstructorName varchar(50) 17 | ); 18 | 19 | create table Courses 20 | ( 21 | CourseId int not null primary key, 22 | CourseName varchar(100), 23 | CourseCreditHours int, 24 | InstructorId int foreign key references Instructors(InstructorId) 25 | ); 26 | 27 | create table Registration 28 | ( 29 | StudentId int foreign key references Students(StudentId), 30 | CourseId int foreign key references Courses(CourseId), 31 | CGPA float, 32 | primary key (StudentId, CourseId) 33 | ); 34 | 35 | insert into Students values 36 | (1, 'Ali', 2013, 3.3), 37 | (2, 'Aysha', 2013, 4), 38 | (3, 'Ahmed', 2013, 2.2); 39 | 40 | insert into Instructors values 41 | (1, 'Zafar'), 42 | (2, 'Sadia'), 43 | (3, 'Saima'); 44 | 45 | insert into Courses values 46 | (1, 'Computer Programming', 3, 1), 47 | (2, 'Computer Organization and Assembly', 3, 2); 48 | 49 | insert into Courses (CourseId, CourseName, CourseCreditHours) values 50 | (3, 'Computer Programming Lab', 1); 51 | 52 | insert into Registration values 53 | (1, 1, 3), 54 | (1, 3, 3), 55 | (2, 2, 0); 56 | 57 | Select * from Students; 58 | Select * from Instructors; 59 | Select * from Courses; 60 | Select * from Registration; 61 | -------------------------------------------------------------------------------- /Lab 3/L19-1021 _ Lab3.sql: -------------------------------------------------------------------------------- 1 | Create database customer-salesman; 2 | 3 | use [customer-salesman] 4 | 5 | create table salesman 6 | (salesman_id int not null primary key, 7 | sName varchar(50), 8 | city varchar(50), 9 | commission float); 10 | 11 | create table customers 12 | (customer_id int not null primary key, 13 | cust_Name varchar(50), 14 | city varchar(40), 15 | grade int, 16 | salesman_id int foreign key references salesman(salesman_id)); 17 | 18 | create table orders 19 | (ord_no int, 20 | purch_amt float, 21 | order_date date, 22 | customer_id int foreign key references customers(customer_id), 23 | salesman_id int foreign key references salesman(salesman_id)); 24 | 25 | insert into salesman values 26 | (5001,'James Hoog','New York',0.15), 27 | (5002,'Nail Knite','Pairs', 0.13), 28 | (5005,'Pit Alex','London',0.11), 29 | (5006,'Mc Lyon','Pairs',0.14), 30 | (5007,'Paul Adam','San Jose',0.13), 31 | (5003,'Lauson Hen','San Jose',0.12); 32 | 33 | insert into customers values 34 | (3002,'Nick Rimando','New York',100,5001), 35 | (3007,'John Brad Davis','New York',200,5001), 36 | (3005,'Graham Zusi','California',200,5002), 37 | (3008,'Julian Green','London',300,5002), 38 | (3004,'Fabian Johnson','Pairs',300,5006), 39 | (3009,'Geoff Cameron','Berlin',100,5003), 40 | (3003,'Jozy Altitor','Moscow',200,5007), 41 | (3001,'John Brad Guzan','London', NULL,5005); 42 | 43 | insert into orders values 44 | (70001,150.5,'2012-10-05',3005, 5002), 45 | (70009,270.65,'2011-09-10',3001, 5005), 46 | (70002,65.26,'2014-10-05',3002, 5001), 47 | (70004,110.5,'2011-8-17',3009, 5003), 48 | (70007,948.5,'2012-9-10',3005, 5002), 49 | (70005,2400.6,'2010-07-27',3007, 5001), 50 | (70008,5760,'2013-9-10',3002, 5001), 51 | (70010,1983.43,'2010-10-10',3004, 5006), 52 | (70003,2480.4,'2013-10-10',3009, 5003), 53 | (70012,250.45,'2010-6-27',3008, 5002), 54 | (70011,75.29,'2014-08-17',3003, 5007), 55 | (70013,3045.6,'2010-04-25',3002, 5001); 56 | 57 | 58 | select *from customers 59 | where city = 'New Yourk'; 60 | 61 | select *from customers 62 | where cust_Name like '%John%' and (city = 'London' or city = 'Paris' or city = 'New Yourk'); 63 | 64 | select *from customers 65 | where (city = 'London' or city = 'New Yourk'); 66 | 67 | select *from orders 68 | where (purch_amt>500); 69 | 70 | select *from salesman 71 | where(sName like '_a%'); 72 | 73 | select commission, commission+0.5 as UpdatedCommission 74 | from salesman 75 | where city = 'San Jose'; 76 | 77 | select *from orders order by order_date desc; 78 | 79 | select sName,LEFT(sName,CHARINDEX(' ',sName)) as firstname 80 | from salesman; 81 | 82 | select *from orders 83 | where (DATEPART(MONTH, order_date)=2); 84 | 85 | --Task 10 86 | 87 | select DATENAME(day,order_date) as Day_of_month, 88 | DATENAME(WEEKDAY,order_date) as week_day, 89 | DATENAME(WEEK,order_date) as week, 90 | DATENAME(DAYOFYEAR,order_date) as day_of_year, 91 | DATENAME(month,order_date) as name_of_month, 92 | DATENAME(year,order_date) as year 93 | from orders 94 | where DATEPART(month, order_date) = 10; 95 | 96 | select order_date,purch_amt,purch_amt*3 as triple_amt 97 | from orders 98 | where (DATEPART(MONTH, order_date)=11); 99 | 100 | select *from customers 101 | left join orders on orders.customer_id = customers.customer_id where( DATEPART(year, order_date) = 2011 or DATEPART(year, order_date) = 2013); 102 | 103 | select *from salesman 104 | where commission = (select MAX(commission) from salesman); 105 | 106 | -------------------------------------------------------------------------------- /Lab 3/Lab Manual 3 Data Retrieval.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fazeelkhalid/Database-management-system/f12937423535aae1342004eecec0aee209270c32/Lab 3/Lab Manual 3 Data Retrieval.docx -------------------------------------------------------------------------------- /Lab1-Q1/Lab 1(Q1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fazeelkhalid/Database-management-system/f12937423535aae1342004eecec0aee209270c32/Lab1-Q1/Lab 1(Q1).pdf -------------------------------------------------------------------------------- /Lab1-Q1/Task1(a).aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Task1.aspx.cs" Inherits="Lab_1.WebForm1" %> 2 | 3 | 4 | 5 | 6 |
7 |