0% found this document useful (0 votes)
145 views

Sem2 IDC BCA-124 P Working With Data Using MySQL

This document describes a course on working with data using MySQL. The course aims to enable students to work with database applications. It has 2 credits and no prerequisites. The course contains 2 units that cover basic and advanced MySQL topics over 30 hours each. Example assignments are provided that involve creating databases with multiple tables, applying constraints and relationships between tables, and performing queries on the data.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views

Sem2 IDC BCA-124 P Working With Data Using MySQL

This document describes a course on working with data using MySQL. The course aims to enable students to work with database applications. It has 2 credits and no prerequisites. The course contains 2 units that cover basic and advanced MySQL topics over 30 hours each. Example assignments are provided that involve creating databases with multiple tables, applying constraints and relationships between tables, and performing queries on the data.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Course Name: Working with Data using MySQL

Course Code: IDC-BCA-124 P

Credits: 2

Course Outcomes:
The aim of this course is to enable students to
 Work with database applications.

Prerequisites: No prerequisites

Contents:

Unit Particulars Hours Credits


No.
1. Unit Title: Basic Introduction of DBMS and MySQL 30 1
Introduction of DBMS. How MySQL Works? Why we use MySQL, MySQL
Features, How to install MySQL (XAMPP)
MySQL Data Types:-Numeric, Date and Time, String
MySQL Operator:-Arithmetic Operators, Comparison Operators, Logical
Operators, Special Operators (LIKE, BETWEEN,EXIST,IN, IS NULL)
Aggregate Functions : AVG,MIN,MAX,SUM,COUNT
MySQL Commands :
DDL - CREATE, DROP,ALTER,SELECT
DML-INSERT , UPDATE, DELETE

Using MySQL Workbench Interface : Create Database, Drop Database, Create


table, Insert records in table, Delete records, Rename table, Drop Table, Drop
database, Change column type or size, Add/Delete Column, Change column
name.
MySQL Queries :- Queries based on Insert, Update, Delete , Select statement
using Where Clause.

2. Unit Title: Advanced MySQL 30 1

MySQL Constraints (NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK,
DEFAULT), MySQL Clauses(WHERE Clause, ORDER BY clause, HAVING Clause,
TOP Clause, GROUP BY Clause), MySQL Join (Cross Join, Natural Join),
Establishing Relationship : Creating ER diagram of database in MySQL
Workbench.
Following type of sample applications can be asked in exam

1. Create a database BANKING with the following tables


Set appropriate datatypes and set primary keys and foreign keys, create relationship between
tables and create E-R Model .

 Customer(cid,c_name,address,email,city)
 Loan(Loanid,cid,amount,rate_of_interest,loan_type,issue_date)
Values for loan_type should be “HOUSING”,”PERSONAL” and “VEHICLE” only.

Perform the following queries


a) Update the city of cid=2 to “Ahmedabad”
b) Display the loan details of customers where loan amount is > 50,000 and rate_of_interest is
less than 4.5%.
c) Display customer name, loan type and loan amount.
d) Default value for rate_of_interest should be 6.5%.
e) Arrange the records of customer in descending order of city.

2. Create a database EVENT_MANAGEMENT with the following tables


Set appropriate datatypes and set primary keys and foreign keys, create relationship between
tables and create E-R Model .

 Event(eid,ename,start_date,end_date)
 Participants(pid,eid,P_name,gender)
Gender should be ‘M’ or ‘F’ only. And Value for ename should not be null and default value
should be “BIRTHDAY”.
Perform the following queries
a) Count the number of participants where eid=2.
b) Display the records of participants who have participated in “BIRTHDAY”.
c) Display the records of events where ename begins with ‘B’.
d) Display all event starting between “2022/03/03” and “2022/05/05”
e) Create a view EVENTDETAIL, that displays events other than “BIRTHDAY”.

3. Create a database BOOKDETAILS with the following tables


Set appropriate datatypes and set primary keys and foreign keys, create relationship between
tables and create E-R Model.
 Publisher(pid,pname,contact_no)
 Book(bid,bname,price,pid,edition)

Perform the following queries


a) Display all the records from Book table where edition is either (1,2 or 4) using IN operator.
b) Display only book name and publisher name where price is less than 500.
c) Display the details of book where price is highest.
d) Update the price of book to 2500 where edition is > 4
e) Display the average price of the books.
4. Create a database EMPLOYEE_DUTY with the following tables
Set appropriate datatypes and set primary keys and foreign keys, Create relationship between
tables and create E-R Model .
 Employee(empid,empname,skill,pay)
 Duty(dutyid,empid,day,shift)

Perform the following Queries:


a) Display names of all employees who came on Monday.
b) Find the employee names which ends with ‘I’.
c) Display total no. of employees where skill is other than “PROGRAMMERS”.
d) Display employee details where pay is more than 10000.
e) Display employee details of where skill is “DBA”.

5. Create a database MYORDERS with the following tables


Set appropriate datatypes and set primary keys and foreign keys, create relationship between tables
and create E-R Model .
 Product(pid,pname,product_description,disc_available)
 Order(pid,oid,odate,qty,price)
Values for discount available should be ‘Y’ or ‘N’
Perform the following queries
a) Display product details where disc_available is ‘Y’.
b) Display order details where quantity>5 and price< 2000.
c) Display order details along with product name.
d) Display minimum price order.
e) Count the number of orders where price is > 2500.

6. Create a database FACULTY_INFO with the following tables


Set appropriate datatypes and set primary keys and foreign keys, create relationship between tables
and create E-R Model .

 Faculty (fid,fname,qualification,salary)
 Course(cid,fid,course_name,fees)
Perform the following queries
a) Default value for salary should be 10,000.
b) Display the name of courses where fees are greater than 25000.
c) Display the faculty names and course name for BCA course
d) Display the records of faculties where qualification is “M.COM”.
e) Update the fees of course to 25000 where where course_name is “MCA”
7. Create a database LIBRARY_DB with the following tables
Set appropriate datatypes and set primary keys and foreign keys. Create relationship between tables
and create E-R Model.

 Book_Category(catid,cat_name)
 Book_details(bid,bname,publication,author,price,catid)
Perform the following queries
a) Display books where book name begins with letter “P” or “M”.
b) Update price of book “DATABASE” to 2000.
c) Count number of books where publication is “DREAMTECH”
d) Display books where price is >500 and catid is 2
e) Create a view BOOK which will display all the book details where price is between 500 and 1000.

8. Create a database HOSPITAL_DETAILS with the following tables


Set appropriate datatypes and set primary keys and foreign keys,create relationship between
tables and create E-R Model .
 Doctor(docid,name,dept,gender)
 Patient(pid,pname,disease,docid,charges)
Perform the following queries
a) Display the records for doctors where dept = “Surgery”.
b) Display the records of patients treated by MALE doctors.
c) Display the patients records where disease is “APPENDIX”.
d) Count the number of patients where docid is 2
e) Display the records of doctors where doctors name begins with letter S.

9. Create a database MOBILE_DETAILS with the following tables


Set appropriate datatypes and set primary keys and foreign keys, create relationship between
tables and create E-R Model .
 Handsets(mobid,mobname,touchscreen,type,cost,qty)
 vendor (vid,mobid,shopname,city)
Value for touchscreen should be either “Y” or “N”
Perform the following queries
a) Handset type should be “CDMA” , “Smartphone” and “GSM” only.
b) Display handset details for “AHMEDABAD” city
c) Display the shop name where mobid = 5.
d) Update city to Mumbai where qty > 6.
e) Display handset details where touchscreen = ‘Y’.

10. Create a database PAYROLL with the following tables


Set appropriate datatypes and set primary keys and foreign keys,create relationship between
tables and create E-R Model .
 Item(itemid,item_name,quantity,price,sid)
 Supplier(sid,sname,contact_no,address)
Perform the following queries
a) Default value for quantity should be 10.
b) Display all the records from items where quantity > 15 and price > 2000.
c) Update quantity = 12 where price < 2000.
d) Count the number of items where sid=4.
e) Create a view ITEMDETAIL which displays all the items where quantity is >50 in descending
order of item name.

---------------------------------

You might also like