rdbms-record
rdbms-record
Register No.:
BONAFIDE CERTIFICATE
4052470 – RELATIONAL DATABASE AND MANAGEMENT SYSTEMS
PRACTICAL
Name: …………………………………………………
Reg. No.: ……………….…………………………….
Roll No.: ………………………………………………
Year/Semester: …………………………………….
PART-A
1 MY SQL INSTALLATION AND CONFIGURATION
5 TRANSACTION MANAGEMENT
6 NORMALIZATION
PART-B
9 FLOW CONTROL MANAGEMENT IN BANK DATABASE
10 JOINS
11 STORED PROCEDURE
12 TRIGGER
13 STORED FUNCTION
14 CURSOR
OBSERVATION MARK
RECORD MARK
TOTAL
Aim:
To Install, configure and connect to MySQL Server and MySQL Workbench in Windows. And
to Create a Database, backup and restore the Database.
Hardware Requirement:
1. Computer System with Pentium Processor
2. Printer
Software Requirement:
1. MySQL Server 5.1
2. MySQL Workbench 5.2
Procedure:
Installation for MySQL Server:
1. Download and open installation file for MySQL Server and press “Next” in Setup Wizard.
2. Choose “Typical” setup type and click “Next” and “Install” in option in Setup
Wizard for Installation Settings.
3. Click “Next” and “Next” in MySQL Enterprise Server and MySQL Enterprise
Monitor Service window.
4. To Complete the Installation Process, Click Check box in “Configure & Register the
MySQL Server Now” options and Click “Finish” Button.
5. In MySQL Server Instance Configuration Wizard click “Next” and
Choose “Detailed Configuration” and Click “Next”.
6. Select “Developer Machine” and click “Next” for to select server type.
7. Select “Multifunctional Database” and click “Next” for to select Database usage.
8. Default Drive “C” and Click “Next” in InnoDBTablespace Settings.
9. Select “Decision Support (DSS)/OLAP” and click “Next” for to set the number of
concurrent connections to the server.
10. Check the Options “Enable TCP/IP Networking” and “Enable Strict Mode and
Click “Next” to Set the Networking Option.
11. Select “Standard Character Set” and click “Next” to select the default character set.
12. Check the options “Install as Window Service” and “Include Bin Directory in
Windows PATH” and Click “Next” to set the Windows options.[ Service Name
: MySQL].
13. Give the “Root Password” and Check the option “Enable root access from remote
1. Download and open installation file for MySQL Workbench and press “Next” in Setup
Wizard and press ‘Next’ in destination folder wizard.
2. Choose ‘Complete’ and click ‘Next’ in Setup Type wizard and click ‘Install’ in Ready to
install the Program wizard.
3. After Installation process click ‘Finish’ option.
Thus the Mysql Installation, Configuration and connecting to Mysql Server and Mysql
Workbench in Windows was done successfully. And created a Database, backup and restore the
Database also done successfully.
Aim:
To study Basic MySQL commands (create database, create table, use, drop, insert) and execute
the following queries using these commands:
Create a database named ‘employee’.
Use the database ‘employee’ and create a table ‘emp’ with attributes ‘ename’, ‘ecity’,
‘salary’, ‘enumber’, ‘eaddress’, ‘deptname’.
Create another table ‘Company’ with attributes ‘cname’, ‘ccity’, ‘empnumber’ in the
database ‘employee’.
Hardware Requirement:
Software Requirement:
Procedure:
Result:
Thus the database employee is created with two entities and performed the basic MySQL
commands successfully.
Aim:
To study the viewing commands (select, update) and execute the following queries using these
commands:
Find the names of all employees who live in Chennai.
Change the company city to Chennai where the company name is ‘TCS’.
Hardware Requirement:
Software Requirement:
Procedure:
Result:
Thus the database employee is created with two entities and performed the viewing commands
successfully.
Aim:
To study the commands that involve compound conditions (and, or, in, not in, between, not
between, like, not like) and execute the following queries using these commands:
Find the names of all employees who live in ‘Chennai’ and whose salary is between Rs.20,000 to
Rs.30,000.
Find the names of all employees whose names begin with either letter ‘A’ or ‘B’.
Find the company names where the company city is ‘Chennai’ and the number of employees is
not between 5000 and 10,000.
Find the names of all companies that do not end with letter ‘A’ .
Hardware Requirement:
Software Requirement:
Procedure:
i) Finding the names of all employees who live in ‘Chennai’ and whose salary is
between Rs.20000 to Rs.30000.
mysql> select ename from emp where ecity=’Chennai’ AND salary BETWEEN
20000 and 30000;
ii) Finding the name of all employees whose names begin with either letter ‘A’ or ‘B’.
mysql> select ename from emp where ename LIKE ‘A%’ OR ename LIKE ‘B%’;
iv) Finding the names of all companies that do not end with letter ‘A’.
mysql> select distinct cname from company where cname NOT LIKE ‘%A’;
Thus the database employee is created with two entities and performed the commands that
involve compound conditions successfully.
TRANSACTION MANAGEMENT
Aim:
To Create a Database ‘polytechnic_college’ and to create two users namely ‘staff ’and `student’.
To grant all privileges to the users ‘Staff ’and grant only ‘create’ privileges to
‘student’ user and verify the same.
To revoke all privileges to the 2 users and verify the same.
To implement the following transaction control statements.
i) Commit
ii) Rollback
iii) Save point
Hardware Requirement:
Software Requirement:
Procedure:
i) Commit
Creating a table
Using commit
mysql> commit;
ii) Rollback
Starting transaction
mysql> rollback;
Creating a table
mysql> commit;
Result:
Thus the users are created and applied the grant and revoke privileges and also implement the
Transaction Management command successfully.
NORMALIZATION
Aim:
To Create table ‘author’ with the following structure author_id author_name address mobile
book_title pages published_on
i) Insert 4 books published by 3 authors each. (12 records)
ii) Fetch all the rows and observe how the data duplicated.
iii) Apply 1st and 2nd normal forms to fix it.
Hardware Requirement:
Software Requirement:
Procedure:
iii) Applying first and second normal forms to avoid duplicated entries i.e., Splitting
the table into two tables author_information and book_titles1.
Creating a new table containing author information, avoiding duplication.
Now for displaying both the tables information, use the following query (ie Natural
join)
Result:
Thus the author table is created and inserted the values for the observation of the created table,
there is a duplicated records. For that applied the 1st and 2nd normal form successfully and removed the
duplicated entries.
Aim:
To study the commands for views and execute the following queries using these commands:
Hardware Requirement:
Software Requirement:
Procedure:
i) Using database
iii) In the above view changing the ecity to ‘Chennai’ where ename is ‘John’.
v) Update the view and increase the salary of all employees of IT deparment
by Rs.1000
Result:
Thus the view is created and displayed all the requests successfully.
Aim:
To Create a library table with proper fields. Create another table called library1 and insert rows
from library table.
Hint:
CREATE TABLE new_table LIKE original_table;
INSERT INTO new_table SELECT * FROM original_table;
Hardware Requirement:
Software Requirement:
Procedure:
Inserting rows into the table library1 from the table library
Result:
Thus the library table is created and inserted the values into another table library1
successfully.
Aim:
To Create a table to store the details of a customer in a Bank. Do some transactions like
withdrawal, deposit. Find the Balance amount(Credit Limit). Based on customer’s credit limit, write a
program using IF or CASE flow control statements to find the customer levels namely SILVER,
GOLD or PLATINUM.
less than 50K and greater than 10K, then the customer level is GOLD
Hardware Requirement:
Software Requirement:
Procedure:
Thus the flow control statements are used in a bank table and retrieve the information
successfully.
JOINS
Aim:
To Create two tables with the following structure.
a) users - table name
user_id - UNSIGNED, INT, AUTO INCREMENT, PRIMARY KEY
username - VARCHAR (60) password - VARCHAR (128) ,email - VARCHAR (255)
b) users_profiles
user_id - FOREIGN KEY refers to user_id field of user table first_name -
VARCHAR(60), last_name - VARCHAR(60) mobile - VARCHAR(15)
Hardware Requirement:
Software Requirement:
Procedure:
Result:
Thus the join command is used to join the two tables and retrieved the information successfully.
STORED PROCEDURE
Aim:
To Create an employee database and create a stored procedure that accepts employee_Id as input
and returns complete details of employee as output.
Hardware Requirement:
Software Requirement:
Procedure:
Creating a procedure
Result:
Thus the stored procedure is created to accept the employee id and returns complete details of an
employee as output successfully.
TRIGGER
Aim:
To Create two tables with the following structure
Authors
author_id - INT
name VARCHAR (60)
titles_count INT -- holds the total number numbers of titles authored.
Titles
author_id - INT
name VARCHAR (512) -- name of the title
a. Create a trigger to update the titles count field of respective row in authors table each
time a title gets inserted into titles table.
b. Create log table with the following structure author_id – INT
name VARCHAR (512) -- name of the title
status VARCHAR(25) --- ADDITION,DELETION,UPDATION
and insert an entry in that table each time the tile is added, deleted or updated. Use
a trigger to accomplish this.
Hardware Requirement:
Software Requirement:
Procedure:
Creating a trigger to update the title count of authors table when inserting into titles
table
(enter the following commands in the file ex12a.sql using notepad)
Creating a trigger to insert into log_table when inserting into titles table
Result:
Thus the trigger is created and updated the title count and log table is updated as added, deleted
and updated for each entry in author table successfully.
STORED FUNCTION
Aim:
To create a table containing phone number, user name, address of the phone user. Write a
function to search the address using phone number.
Hardware Requirement:
Software Requirement:
Procedure:
Result:
Thus the function is written to search address using phone number in phone book table
successfully.
CURSOR
Aim:
To create a table to store the salary details of the employees in a company. Declare the cursor id
to contain employee number, employee name and net salary. Use cursor to update the employee.
Hardware Requirement:
Software Requirement:
Procedure:
Creating a cursor
Result:
Aim:
To program to connect PHP with MySQL and create a database using PHP MySQL.
Hardware Requirement:
Software Requirement:
Procedure:
Open a browser
following http://localhost/database.php
Now PHP is connected with MySQL and the database named rdbms is created using
PHP MySQL.
Output:
Thus the program to connect PHP with MySQL and create a database using PHP MySQL
successfully.