Sujal Ism File
Sujal Ism File
Information System
Management [ BBA-307]
Session 2021-24
1
INDEX
2
LAB PRACTICAL ASSIGNMENT
QUES:
Q1. Write difference between DBMS and RDBMS?
Q2. What is SQL? Basics of SQL ? DDL and DML
Commands? Q3 What are different Data types in SQL
Q4. Create table STUDENT with fields: Rollno, Name, Course, DOB and
Display structure
1. modify the structure of student table
add new columns section and contact no,
city. change the size of course column by 2
points.
2. Insert 10 records.
3. Add column age . calculate age using DOB
4. Execute following queries
Display all the details of student table
Display names in alphabetical order
Display records where name starts with
'A' Display records for city 'delhi'
Q5. Create table employee: empno(PK), empname(NOT NULL),Add,
salary(NOT NULL),Designation,
Deptname,
commission Insert 5
records
Find Average and total salaries of all employees
Find minimum and maximum salary of
Manager count total no of departments
Count total no of employees in each dept
update the commission to 10% of salary for all having salary greater than
50000 and rest with
5%
3
Find the name of lowest paid
employee List average salary for all the
dept.
4
List desig and no of employees in each desig
list average salary of each desig excluding managers.
List total, Max, Min, Average salary of employees designation wise
Q6. Create table stu_details : Enroll_no, s_name,course_id,batch,semester
1. Enter 10 records
2. Execute queries
Display the list of students in batch '2017-2020'
Display the enroll_no of fourth semester
students Display the total no of students
semester wise
3. Create table course: course_id, course_name, duration
4. Enter 10 records
5. Create relationship of course with student
table Display all students enrolled in BBA course
Display name of students enrolled in 2 year course
Display details of students of BBA course of batch '2017-
2020' Q7.
1. Show records of employees whose emp_id is 101
2. Display records whose dept_name is HR and salay >10000
3. update the records set Dept_name=IT where dept_name is 'production'
4. update records of employees to increase salary by 5%
Q8. Create a table as student_marks: roll_no,sub1,sub2,sub3,sub5,sub5,total
and percentage
Enter rollno and all subject marks for 10 students
calculate total and percentage using update command
display rollno , name and total marks of the students using student
and student_marks table for
the students having percentage >80%
Q9. Explain ER diagram with their symbols used.
Q10. Create ER diagram for Library management system
5
Q11 . Create ER diagram for Employee management syste
6
LAB PRACTICAL ASSIGNMENT SOLUTIONS
8
3. **SQL Joins:** SQL allows you to combine rows from two or more tables based
on a related column between them. Common types of joins include INNER JOIN,
LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.
4. **SQL Functions:** SQL provides a variety of built-in functions for performing
operations on data. Examples include COUNT(), SUM(), AVG(), MAX(), MIN(),
and more.
**DDL (Data Definition Language) Commands:**
1. **CREATE:** Used to create a new database, table, index, or
view. COMMAND:-
CREATE TABLE table_name
( column1 datatype,
column2 datatype,
...
);
2. **ALTER:** Modifies the structure of an existing database, table, or
index. COMMAND:-
ALTER TABLE table_name
ADD column_name
datatype;
3. **DROP:** Deletes an existing database, table, index, or
view. COMMAND:-
DROP TABLE table_name;
9
INSERT INTO table_name (column1, column2, ...)
10
VALUES (value1, value2, ...);
3. **UPDATE:** Modifies existing records in a
table. COMMAND:-
UPDATE table_name
SET column1 = value1, column2 =
value2, ... WHERE condition;
11
6. **REAL:** Represents single-precision floating-point numbers.
7. **DOUBLE PRECISION:** Represents double-precision floating-point numbers.
8. **CHARACTER (CHAR):** Represents fixed-length strings. You must specify
the length when defining a CHAR column.
9. **VARCHARACTER (VARCHAR):** Represents variable-length strings. You
must specify the maximum length when defining a VARCHAR column.
10. **TEXT:** Represents variable-length strings with a very large maximum length.
11. **DATE:** Represents a date in the format YYYY-MM-DD.
12. **TIME:** Represents a time of day in the format HH:MI:SS.
13. **DATETIME or TIMESTAMP:** Represents a combination of date and time.
14. **BOOLEAN:** Represents true or false values.
15. **BINARY:** Represents fixed-length binary data.
16. **VARBINARY:** Represents variable-length binary data.
17. **BLOB (Binary Large Object):** Represents large binary objects, such as
images or multimedia data.
18. **CLOB (Character Large Object):** Represents large text objects.
These data types may have variations or additional options depending on the specific
database management system (DBMS) you are using (e.g., MySQL, PostgreSQL, SQL
Server, Oracle). It's essential to refer to the documentation of the specific DBMS you
are working with for precise details on data types and their usage.
12
Q4. Create table STUDENT with fields: Roll no, Name, Course, DOB and
Display structure
2. Insert 10 records
13
ANS CREATE TABLE
OUTPUT
1
MODIFY THE TABLE
OUTPUT
INSERT RECORD
OUTPUT
1
CALCULATING AGE
OUTPUT
1
Q5. Create table employee: empno(PK), empname(NOT NULL), Add, salary(NOT NULL),
Designation, Deptname, commission
● Insert 5 records
● update the commission to 10% of salary for all having salary greater than
50000 and rest with 5%
1
ANS CREATE TABLE
OUTPUT
ADD COLUMN
OUTPUT
1
INSERT RECORDS
OUTPUT
OUTPUT
1
COUNT TOTAL NO. OF DEPTARTMENT
OUTPUT
2
COUNT TOTAL NO. OF EMPLOYEE
OUTPUT
UPDATE THE COMISSION TO 10% OF SALARY FOR ALL HAVING SALARY GRATER THAN 5000
AND REST WITH 5%
OUTPUT
2
FIND THE NAME OF LOWEST PAID EMPLOYEE
OUTPUT
OUTPUT
2
LIST DESIGN AND NO OF EMPLOYEES IN EACH DESIGN
OUTPUT
OUTPUT
2
AVG OF SALARY WITH DESIGNATION
OUTPUT
OUTPUT
2
MIN OF SALARY WITH DESIGNATION
OUTPUT
OUTPUT
2
Q6. Create table stu_details : Enroll_no, s_name,course_id,batch,semester
1. Enter 10 records
2. Execute queries
4. Enter 10 records
2
Ans CREATE TABLE
OUTPUT
2
NSERT RECORDS
OUTPUT
OUTPUT
2
Display the total no of students semester wise
OUTPUT
CREATE TABLE
OUTPUT
2
INSERT RECORDS
OUTPUT
OUTPUT
3
Display all students enrolled in BBA course
OUTPUT
OUTPUT
3
Display details of students of BBA course of batch '2017-2020'
OUTPUT
Q7.
3
ANS
Show records of employees whose emp_id is 101
Output
OUTPUT
3
Update the records set Dept_name=IT where dept_name is 'production'
OUTPUT
Output
3
Q8. Create a table as student marks: roll_no,sub1,sub2,sub3,sub4,sub5, total, and percentage
● display roll no and total marks of the students using student and student marks
table for the students having percentage >80%
Output
3
Enter roll no and all subject marks for 10 students
Output
3
Calculate total and percentage using update command
OUTPUT
Display roll no and total marks of the students using student and student marks table
for the students having percentage >80%
OUTPUT
3
Q9. Explain ER diagram with their symbols used.
SOLUTION
An Entity-Relationship (ER) diagram is a visual representation of the data model that
depicts the logical structure of a database. It is widely used in database design to
illustrate the relationships between different entities in a system. The main
components of an ER diagram include entities, attributes, and relationships, each
represented by specific symbols. Here's an overview of the symbols used in ER
diagrams:
1. **Entity:**
- **Symbol:** Rectangle
- **Description:** Represents a real-world object or concept, such as a person,
place, event, or thing. The name of the entity is written inside the rectangle.
2. **Attribute:**
- **Symbol:** Oval or Ellipse
- **Description:** Represents a property or characteristic of an entity. Attributes are
written inside ovals and are connected to their respective entities. For example, if you
have an entity "Person," attributes could include "Name," "Age," and "Address."
3. **Primary Key:**
- **Symbol:** Underlined attribute
- **Description:** Indicates the attribute or combination of attributes that uniquely
identifies each instance of an entity. It is usually underlined.
4. **Relationship:**
- **Symbol:** Diamond
- **Description:** Represents an association between two or more entities. The
name of the relationship is written inside the diamond. Lines connect the participating
entities to the diamond, indicating their involvement in the relationship.
3
5. **Cardinality Notation:**
- **Symbol:** Crow's foot (for "many") or a straight line (for "one")
- **Description:** Indicates the number of instances of one entity that can be
related to the number of instances of another entity. Common cardinalities include
"one" (|) and "many" (crow's foot). For example, a line connecting a "Person" entity to
an "Address" entity with a crow's foot on the "Address" side might represent "one
person has many addresses."
6. **Weak Entity:**
- **Symbol:** Double rectangle
- **Description:** Represents an entity that does not have a primary key attribute of
its own and is dependent on another entity for identification. The double rectangle
indicates a weak entity.
7. **Inheritance/Generalization:**
- **Symbol:** Triangle (with a line connecting it to the superclass)
- **Description:** Represents an "is-a" relationship between entities, often used to
denote inheritance in object-oriented design. The superclass is the more general
entity, and the subclass is a more specific entity.
These symbols are combined in an ER diagram to visually represent the structure and
relationships within a database. The connections between entities and the cardinality
notations help convey how different entities are related to each other in the overall
data model.
3
Entities:
1. **Book**
- Attributes: ISBN (Primary Key), Title, Author, Genre, Publication Year, Copies
Available, etc.
2. **Author**
- Attributes: AuthorID (Primary Key), Name, Birthdate, Nationality, etc.
3. **Member**
- Attributes: MemberID (Primary Key), Name, Address, Phone, Email, etc.
4. **Transaction**
- Attributes: TransactionID (Primary Key), BookID (Foreign Key), MemberID (Foreign
Key), Issue Date, Due Date, Return Date, etc.
Relationships:
1. **Authors write Books**
- One-to-Many relationship between Author and Book (an author can write multiple
books, but a book has one author).
4
4. **Books are involved in Transactions**
- One-to-Many relationship between Book and Transaction (a book can be part of
multiple transactions, but each transaction involves one book).
Entities:
1. Employee
2. Department
3. Position
4. Project
5. Skill
Attributes:
1. Employee:
- EmployeeID (Primary Key)
- FirstName
- LastName
- DateOfBirth
4
- Gender
- ContactNumber
- Email
- HireDate
- Salary
- Address
2. Department:
- DepartmentID (Primary Key)
- DepartmentName
3. Position:
- PositionID (Primary Key)
- PositionTitle
- Responsibilities
4. Project:
- ProjectID (Primary Key)
- ProjectName
- StartDate
- EndDate
- Budget
5. Skill:
- SkillID (Primary Key)
- SkillName
4
Relationships:
1. WorksIn: - Employee (1) ------< WorksIn >------(M) Department
2. Occupies:
- Employee (1) ------< Occupies >------(M) Position
3. AssignedTo:
- Employee (M) ------< AssignedTo >------(M) Project
4. Possesses:
- Employee (M) ------< Possesses >------(M) Skill
Keep in mind that this is a simplified representation, and in a real-world scenario, you
might need to consider additional details and constraints. The actual requirements of
your Employee Management System may vary, so adjust the entities and attributes
accordingly based on your specific needs.
4
4