0% found this document useful (0 votes)
17 views35 pages

Trip-Tea Dbms

kjjjjjjjj
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)
17 views35 pages

Trip-Tea Dbms

kjjjjjjjj
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/ 35

1

INDIRA GANDHI DELHI TECHNICAL


UNIVERSITY FOR WOMEN

Lab File

Multimodal Data Analysis (BAI-401)


B. TECH, Electronics and Communication Engineering-
Artificial Intelligence
(2021 - 2025)

Submitted to: Prof. Ravi Prakash Submitted By: Khushi Chauhan


Enrollment Number: 05901182021
1

INDIRA GANDHI DELHI TECHNICAL


UNIVERSITY FOR WOMEN

Lab File

Multimodal Data Analysis (BAI-401)

B. TECH, Electronics and Communication Engineering -


Artificial Intelligence
(2021 - 2025)

Submitted to: Prof. Ravi Prakash Submitted By: Shubhi Verma


Enrollment Number: 04001182021
1

INDIRA GANDHI DELHI TECHNICAL


UNIVERSITY FOR WOMEN

Lab File

Multimodal Data Analysis (BAI-401)


B. TECH, Electronics and Communication Engineering - Artificial
Intelligence
(2021 - 2025)

Submitted to: Prof. Ravi Prakash Submitted By: Ruchira Kumar


Enrollment Number: 05501182021
2

PRACTICAL-1

A) CONCEPT DESIGN WITH E-R MODEL USING BUS RESERVATION


SYSTEM

Aim:
To relate the entities appropriately. Apply cardinalities for each relationship. Identify strong and weak entities.
Indicate the type of relationships(total/partial). Incorporate generalization, aggregation, specialization, etc whenever
required.
Theory:

 ER model stands for an Entity-Relationship model. It is a high-level data model. This model is used to
define the data elements and relationships for a specified system.
 It develops a conceptual design for the database. It also develops a very simple and easy-to-design view of
data.
 In ER modeling, the database structure is portrayed as a diagram called an entity-relationship diagram.
 The

Component of ER Diagram

1. Entity:

An entity may be any object, class, person, or place. In the ER diagram, an entity can be represented as rectangles.

2. Attribute

The attribute is used to describe the property of an entity. Eclipse is used to represent an attribute.

3. Relationship

A relationship is used to describe the relation between entities. A diamond or rhombus is used to represent the
relationship.
3

E-R Model:
1) Bus

 BusNo
 Source
 Destination
 CoachType
SCHEMA
Bus: Bus(BusNo:String,Source:String,Destination:String,CoachType:String)

BusNo
Source Destination
CoachType

BUS

2) Ticket

 TicketNo
 DOJ
 Address
 ContactNo
 BusNo
 SeatNo
 Source
 Destination
SCHEMA
Ticket(TicketNo:String,DOJ:Date,Address:String,ContactNo:Integer,BusNo:String,SeatNo:Integer,Source:String,Dest
ination:String)

Address ContactNo
DOJ
BusNo
Ticket No SeatNo

Source

Destination

Ticket
4

3) Passenger

 PassportID
 TicketNo
 Name
 ContactNo
 Age
 Sex
 Address
SCHEMA
Passenger(PassportID:String,TicketNo:String,Name:String,ContactNo:String,Age:Integer,Sex:Character,Address:Stri
ng)
Name Age

PassportID TicketNo ContactNo Sex Address

Passenger

4) RESERVATION

 PNRNo
 DOJ
 No_Of_Seats
 Address
 ContactNo
 BusNo
 SeatNo
SCHEMA
Reservation(PNRNo:String,DOJ:Date,No_of_seats:Integer,Address:String,ContactNo:String,BusNo:String,SeatNo:Int
eger)
Address BusNo
PNRNo DOJ No_of_seats
ContactNo
SeatNo

Reservation
5

5) CANCELLATION

 PNRNo
 DOJ
 SeatNo
 ContactNo
 Status

SCHEMA
Cancellation(PNRNo:String,DOJ:Date,SeatNo:Integer,ContactNo:String,Status:String)

ContactNo
SeatNo
DOJ Status

PNRNo

Cancellation
6

CONCEPT DESIGN WITH ER MODEL

ADDRESS
DOJ
JOURNEY DATE

PNRNo NO_OF_SEATS

RESERVATION

CONTACT_NO
Asks for

Has a
SOURCE SEX
PASSENGER

BUS_NO PNR_NO PPNO


BUS
AGE NAME
DESTINA
TION
TICKET_NO

Has
a
PNR_NO

User DEPT_NO
CANCELLATION asks for
STATUS

JOURNEY TICKET
_DATE TICKET
CONTACT NO

SEAT_NO ADDRESS
AGE
JOURNEY
SEX
_DATE SOURCE
7

B) CONCEPT DESIGN WITH E-R MODEL USING LIBRARY


MANAGEMENT SYSTEM
Aim:
To relate the entities appropriately. Apply cardinalities for each relationship. Identify strong and weak entities.
Indicate the type of relationships(total/partial). Incorporate generalization, aggregation, specialization etc whenever
required.
ER MODEL
1)MEMBER
 Name
 Address
 Member_Type
 Member_Date
 Member_ID
 Expiry_Date
SCHEMA
MEMBER(Name:String.Address:String,Member_Type:String,Member_Date:Integer,Member_ID:Integer,Expiry_Dat
e:
Integer)
MEMBER
MEMBER
_TYPE
ADDRES DATE
NAME MEMBER_ID

EXPIRY_DATE
MEMBER

2) BOOKS
 Author
 Book_ID
 Title
 Price
 Available
SCHEMA
Books(Author:String,Book_ID:String,Title:String,Price:Integer,Available:String)

BOOK_ID TITLE PRICE

AVAILABLE
AUTHOR

BOOKS
8

3) PUBLISHER
 Name
 Address
 Publ_ID
SCHEMA
Publisher(Name:String,Address:String.Publ_ID:String)

ADDRESS Publ_ID
NAME

PUBLISHER

CONCEPT DESIGN WITH ER MODEL


PUBL_ID ADDRESS
BOOK_ID AUTHOR NAME
TITLE

PUBLISHED
BOOKS PUBLISHER
_BY
PRICE

NAME
EXPIRY_ ADDRESS
AVAILABLE
DATE
MEMBER
_TYPE

BORROWED
_BY MEMBER MEMBER_
DATE

MEMBER_ID
9

PRACTICAL-2
Aim: Create a table called Employee with the following structure.
Theory:

DDL (Data Definition Language) :

Data Definition Language is used to define the database structure or schema. DDL is also used to specify additional
properties of the data. The database system uses the storage structure and access methods by a set of statements in a
special type of DDL called a data storage and definition language. These statements define the implementation details
of the database schema, which are usually hidden from the users. The data values stored in the database must satisfy
certain consistency constraints.

some of the DDL commands: CREATE, DROP,ALTER, TRUNCATE etc

DQL (Data Query Language):

DQL statements are used for performing queries on the data within schema objects. The purpose of the DQL
Command is to get some schema relation based on the query passed to it. We can define DQL as follows it is a
component of SQL statement that allows getting data from the database and imposing order upon it. It includes the
SELECT statement.

some of the DDL commands: SELECT: It is used to retrieve data from the database.

DML(Data Manipulation Language):

The SQL commands that deal with the manipulation of data present in the database belong to DML or Data
Manipulation Language and this includes most of the SQL statements. It is the component of the SQL statement that
controls access to data and the database. DCL statements are grouped with DML statements.

some of the DDL commands: SELECT: INSERT, UPDATE: DELETE, LOCK

DCL (Data Control Language):

DCL includes commands such as GRANT and REVOKE , which mainly deal with the database system's rights,
permissions, and other controls.

some of the DDL commands: GRANT, REVOKE

TCL (Transaction Control Language):


10

Transactions group a set of tasks into a single execution unit. Each transaction begins with a specific task and ends
when all the tasks in the group are completed. If any of the tasks fail, the transaction fails. Therefore, a transaction has
only two results: success or failure.

some of the DDL commands: COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION

i. Add a column commission with domain to the Employee table.


ii. Insert any five records into the table.
iii. Update the column details of the job
iv. Rename the column of the Employ table using alter command.
v. Delete the employee whose Empno is 105.

i)

ii)

iii)
11

iv)

v)

B. Create a table called the Customer table

i. Insert records into the table.


ii. Add the salary column to the table.
iii. Alter the table column domain.
iv. Drop the salary column of the customer table.
v. Delete the rows of the customer table whose cust_ciny is Delhi.

i)
12

ii)

iii)

iv)

v)

C. Create a table called the sailor table

i. Add column age to the sailor table.


ii. Insert values into the sailor table.
iii. Delete the row with rating >8.
iv. Update the column details of sailor.
v. Insert null values into the table.
13

i)

ii)

iii)

iv)

v)
14

PRACTICAL-3
Theory:
MySQL Create User
The CREATE USER statement creates new MySQL accounts. It enables authentication, role, SSL/TLS, resource
limit, password management, comment, and attribute properties to be established for new accounts. It also controls
whether accounts are initially locked or unlocked.
If you want to use the Create User, it is required to have a global privilege of Create User statement or the INSERT
privilege for the MySQL system schema. When you create a user that already exists, it gives an error. But if you use,
IF NOT EXISTS clause, the statement gives a warning for each named user that already exists instead of an error
message.
Why we need MySQL Create User?
When the MySQL server installation completes, it has a ROOT user account only to access and manage the databases.
But, sometimes, you want to give the database access to others without granting them full control. In that case, you
will create a non-root user and grant them specific privileges to access and modify the database.

A
a. Create a user and grant all permissions to the user.
b. Insert the any three records in the employee table and use rollback. Check the result.
c. Add primary key constraint and not null constraint to the employee table.
d. Insert null values to the employee table and verify the result

a)
15

b)

c)
16

d)

B.
a) create a user and grant all permissions to the user.
b) Insert values in the department table and use commit.
c) Add constraints like unique and not null to the department table.
d) Insert repeated values and null values into the table.
a)

b)
17

c)

d)

Here in the insert command, we are trying to insert a duplicate value but it is not possible because we define deptno as
a unique constraint.

C.
a) create a user and grant all permissions to the user.
b) Insert values into the table and use commit.
c) Delete any three records in the department table and use rollback.
d) Add constraint primary key and foreign key to the table.

a)
18

b)

c)
19

d)
20

PRACTICAL-4

AIM :- Queries using aggregate functions(COUNT,AVG,MIN,MAX,SUM),Group by, Order by,


Having.

(i) Create Employee table containing all Records.


(ii) Count number of employee names from employee table.
(iii) Find the Maximum age from employee table.
(iv) Find the Minimum age from employee table.
(v) Display the Sum of age employee table.
(vi) Display the Average of age from Employee table.
(vii) Create a View for age in employee table.
(viii) Display views.
(ix) Find grouped salaries of employees.(group by clause)
(x) Find salaries of employee in Ascending Order.(order by clause)
(xi) Find salaries of employee in Descending Order
(xii) Having salary<10000
Theory:
21

i)

ii)

iii)

iv)

v)
22

vi)

vii)

viii)

ix) ’

x)
23

xi)

xii)
24

PRACTICAL-5
AIM: MySQL String Functions

THEORY

ASCII: Returns the ASCII value for the specific character.


CHAR_LENGTH: Returns the length of a string (in characters).
CHARACTER_LENGTH: Returns the length of a string (in characters).
CONCAT: Adds two or more expressions together.
CONCAT_WS: Adds two or more expressions together with a separator.
FIELD: Returns the index position of a value in a list of values.
FIND_IN_SET: Returns the position of a string within a list of strings.
FORMAT: Formats a number to a format like "#,###,###.##", rounded to a specified number of decimal places.
INSERT: Inserts a string within a string at the specified position and for a certain number of characters.
INSTR: Returns the position of the first occurrence of a string in another string.
LEFT: Extracts a number of characters from a string (starting from left).
LOWER: Converts a string to lower-case.
LPAD: Left-pads a string with another string, to a certain length
LTRIM: Removes leading spaces from a string.
REPEAT: Repeats a string as many times as specified.
REPLACE: Replaces all occurrences of a substring within a string, with a new substring
REVERSE: Reverses a string and returns the result
RIGHT: Extracts a number of characters from a string (starting from right)
SPACE: Returns a string of the specified number of space characters
STRCMP: Compares two strings
SUBSTR: Extracts a substring from a string (starting at any position)
SUBSTRING_INDEX: Returns a substring of a string before a specified number of delimiter occurs
TRIM: Removes leading and trailing spaces from a string
UPPER: Converts a string to upper-case
25

CREATING A TABLE THEN WE INSERT THE VALUES


INTO IT.
26
27

PRACTICAL-6

AIM: SQL COMMANDS USINGS JOINS

F. From the following tables write a SQL query to find the salesperson and customer who reside in the
same city. Return Salesman, cust_name and city. Sample table: salesman

Sample table: customer

G. From the following tables write a SQL query to find those orders where the order amount exists
between 500 and 2000. Return ord_no, purch_amt, cust_name, city. Sample table: orders

Sample table: customer


28

H. From the following tables write a SQL query to find salespeople who received commissions of more
than 12 percent from the company. Return Customer Name, customer city, Salesman, commission.
Sample table: customer

Sample table: salesman

I. Write a SQL statement to make a report with customer name, city, order number, order date, and order
amount in ascending order according to the order date to determine whether any of the existing
customers have placed an order or not.

Sample table: orders

Sample table: customer


29

J. Write a SQL statement to generate a list in ascending order of salespersons who work either for one or
more customers or have not yet joined any of the customers. Sample table: customer

Sample table: salesman

THEORY
A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
Different Types of SQL JOINs

Here are the different types of the JOINs in SQL:

• (INNER) JOIN: Returns records that have matching values in both tables
• LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right
table
• RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left
table
• FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
30

a)

1b)
31

c)
32

D)

e)
33

You might also like