Professional Documents
Culture Documents
Submitted To : Submitted By :
Ms. Preeti Talwar Name: - Sahil Khanna
Assoc. Professor, RDIAS Class: - BBA-V
Roll No:--01715901721
NAAC Accredited: A Grade (3rd Cycle), Category A+ Institution (by SFRC, Govt of NCT of Delhi)
1 Annexure 1 25-09-2023
2 Annexure 2 10-10-2023
3 Annexure 3 19-11-2023
CERTIFICATE FROM FACULTY GUIDE
This is to certify that the Information System Management – Lab File is an academic work done
by Sahil Khanna submitted in partial fulfillment of the requirement for the award of degree of
“Bachelors in Business Administration” from “Rukmini Devi Institute of Advanced Studies”
under my guidance and direction.
To the best of my knowledge and belief, the data and information presented by her in the lab file
were not previously submitted elsewhere.
1. Table Name: The name that uniquely identifies the table within the database
2. Columns :
Vertical components representing different data attribute
Each column has a name and a data type associated with it
3. Rows:
Horizontal components representing individual records
Each row contains values corresponding to the attributes defined by the column
Solution.2-
Ques.3- Design an Entity Relationship (ER) model for a college database in MS word. Say
we have the following statements.
a. A college contains many departments
b. Each department can offer any number of courses
c. Many instructors can work in a department
d. An instructor can work only in one department
e. For each department there is a Head
f. An instructor can be head of only one department
g. Each instructor can take any number of courses
h. A course can be taken by only one instructor
i. A student can enroll for any number of courses
j. Each course can have any number of students
Solution.3-
Ques.4- Identify any 5 tables from above case study , create them and add at least 5 rows in
each.
Solution.4-
1. College
2. Department
3. Instructor
4. Course
5. Student
Ques.5- Perform following SQL DDL commands using any tables you created in question 3
A. Rename
B. Drop
C. Delete
D. Truncate
E. Alter
Solution.5-
1. Rename
2. Drop
3. Delete
4. Truncate
5. Alter
Annexure 2
Question 1:
A
Syntax:
create table faculty1528
(T_ID integer primary key,
Name varchar(25) not null,
dept varchar(5),
age integer check (age>=18),
place varchar(30) default 'Delhi',
contact integer UNIQUE);
Input:
Output:
B.
Syntax:
create table salesman_vivid
(salesman_id integer PRIMARY KEY,
name varchar(30),
city char(25),
commission varchar(20));
Input:
C
Syntax:
Create table salesman_vivid
(salesman_id integer,
Name varchar(30),
City char(25),
Commission varchar(20));
Desc salesman_vivd;
Input:
D
Syntax:
Select*from salesman_vivid;
Input:
E
Syntax:
select*from salesman_vivid order by salesman_id;
Input:
F.
Syntax:
select* from salesman_vivid where city IN ('Paris','Rome');
Input:
G.
Syntax:
select* from salesman_vivid where salesman_id between 5002 and 5006;
Input:
H.
Syntax:
select* from salesman_vivid where name like('P%M');
Input:
Output after performing all the parts:
Question2:
A
Syntax:
CREATE TABLE faculty (
t_id INT PRIMARY KEY,
name VARCHAR(25) NOT NULL,
dept VARCHAR(5),
age INT CHECK (age >= 18),
place VARCHAR(30) DEFAULT 'delhi',
contact INT UNIQUE
Input:
B
Syntax:
Alter table faculty1411
Add salary varchaar(5);
Input:
Output:
Syntax:
Alter table faculty1411
Add attendance integer;
Input:
Output:
C
Syntax:
Alter table faculty1411
Modify salary interger;
Input:
Output:
D
Syntax:
Alter table faculty 1411
Drop column attendance;
Input:
Output:
Question 3:
Syntax:
Input:
A
Syntax:
select*from hospital_1411 ORDER BY name ASC;
Input:
Output:
B
Syntax:
select name,charges,age from hospital_1411 WHERE sex like 'm';
Input:
Output:
C
Syntax:
select*from hospital_1411 WHERE department='cardiology';
Input:
Output:
D
Syntax:
update hospital_1411 set charges=300 WHERE name='ravina';
Input:
Output:
E
Syntax:
select*from hospital_1411 WHERE age>25 and department='ENT';
Input:
Output:
F
Syntax:
select sum(charges) from hospital_1411 WHERE dateofadm<'1998-feb-12';
Input:
Output:
Question 4:
B
Syntax:
Select count (distinct department) as distinct_department_count from hospital;
Input:
Output:
D
Syntax:
Select AVG(charges) AS average_charges FROM hospital;
Input:
Output:
Annexure 3
S.No LIST OF
QUESTIONS
1. Querying Multiple Tables
TABLE: STAFF_DETAILS
DEPT_ID SALARY BENEFITS CITY
301 15000 2000 Delhi
302 25000 3100 Mumbai
205 25000 2500 Bangalore
406 35000 3500 Delhi
405 12000 2100 Pune
407 40000 3000 Pune
TABLE: STAFF
S_ID NAME AGE POSITION DATEOFJOIN DEPT_ID
1006 Sarah 32 Advisor 11-Feb-1991 205
1007 Manisha 45 Clerk 22-Jun-1979 406
1004 Raghav 42 Manager 01-May-1982 405
1008 George 37 Manager 2-Dec-1984 302
1009 Senzela 29 Clerk 13-june-1993 407
1005 Sam 49 Manager 12-Dec-1972 301
2. Identify the foreign key and Primary key from the tables given in Q1 with justification.
3.
Based on the tables given in the Q1, solve the queries.
4.
Based on the tables given in the Q1, solve the queries.
Answer 1.
1. Construct the table staff using at least three constraints in it.
3. Create table staff_details which references table staff by using appropriate constraint.
4. Insert values in the table staff_details same as provided.
Answer 2.
In the given tables, the primary key and foreign key relationships are as follows:
1. STAFF
1. Primary Key:
Column: S_ID
Justification: The S_ID column is designated as the primary key, which means it uniquely identifies
each record in the STAFF table.
2. Foreign Key:
Column: DEPT_ID
Justification: The DEPT_ID column in the STAFF table is a foreign key that references the primary
key DEPT_ID in the STAFF_DETAILS table. This establishes a link between the two tables,
indicating the department to which each staff member belongs.
2. STAFF_DETAILS
Primary Key:
Column: DEPT_ID
Justification: The DEPT_ID column is designated as the primary key, which means it uniquely
identifies each record in the STAFF_DETAILS table.
Foreign Key:
Column: DEPT_ID
Justification: While DEPT_ID is the primary key for the STAFF_DETAILS table, it is also used as
a foreign key in the STAFF table. This establishes a link between the two tables, ensuring that the
department information is consistent between them.
Summary
The primary key uniquely identifies records within a table, and the foreign key establishes a link between
tables by referencing the primary key of another table, thus creating a relationship between them. In this
case, the DEPT_ID column serves as both the primary key in the STAFF_DETAILS table and a foreign key
in the STAFF table, creating a connection between these two tables based on department information.
Answer 3.
2. Write a query to get the difference between the highest and lowest salaries
3. Find the total of salary and benefits and name it as total salary
4. Display only Dept_id, salary and benefits of the highest benefit given from the table staff_details .
5. Display name, age and position of the staff members having age greater than the average age of all staff
members in descending orders of names.
6. Find minimum and maximum age of managers.
Answer 4.
4. Display S_id, name, benefits and salary of all staff having salary more than 20000.
5. Display S_id, name, benefits, position of staff people where position have ‘e’ present in it.