0% found this document useful (0 votes)
2 views4 pages

Mysql Algorithm

The document outlines a series of exercises involving the creation and manipulation of databases using MySQL. Each exercise includes an aim, algorithm, and result, covering tasks such as creating tables for college, stock, employee, and student marks, as well as performing operations like updating records, joining tables, and managing user privileges. All exercises conclude with the successful execution of MySQL statements.

Uploaded by

devi
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)
2 views4 pages

Mysql Algorithm

The document outlines a series of exercises involving the creation and manipulation of databases using MySQL. Each exercise includes an aim, algorithm, and result, covering tasks such as creating tables for college, stock, employee, and student marks, as well as performing operations like updating records, joining tables, and managing user privileges. All exercises conclude with the successful execution of MySQL statements.

Uploaded by

devi
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/ 4

Ex.

No:1 Create a college database with tables course, staff and


student details. Insert records into the tables using MYSQL.

Aim:

To create a college database with table course, staff and student

Algorithm:

1. Open MYSQL WORKBENCH8.0 CE


2. Connect to MYSQL Using Password :kgac@123
3. Create a college database and create table course, staff and student
details using create table queries.
4. Insert the values in that table using insert queries
5. View the table data using select queries
6. Close MYSQL App
Result:
The above MYSQL statements are executed successfully.
Ex.No:2 Write MYSQL queries to update, remove and Delete record
in stock table (Item no, Item name, Item quantity, price, total).
Aim:

To create a queries to update, remove and Delete record in stock table

Algorithm:
1. Open MYSQL WORKBENCH8.0 CE
2. Connect to MYSQL Using Password :kgac@123
3. Create a shop database and create table stock using create table
queries.
4. Insert the values in that table using insert queries
5. Update, remove and delete the table data using update and delete
queries
6. Close MYSQL App
Result:
The above MYSQL statements are executed successfully

Ex.No:3 Write MYSQL queries to retrieve relevant information from


an employee table.
Aim:
To create a queries to retrieve relevant information from an employee
table.

Algorithm:
1. Open MYSQL WORKBENCH8.0 CE
2. Connect to MYSQL Using Password :kgac@123
3. Create a company database and create table employee using create
table queries.
4. Insert the values in that table using insert queries
5. Retrieve the relevant information using select queries with where
condition
6. Close MYSQL App
Result:
The above MYSQL statements are executed successfully
Ex.No:4 Create a student marks table using MYSQL and apply
aggregate functions.
Aim:
To Create a student marks table and apply aggregate functions.

Algorithm:
1. Open MYSQL WORKBENCH8.0 CE
2. Connect to MYSQL Using Password :kgac@123
3. Create a college database and create table student_mark using create
table queries.
4. Insert the values in that table using insert queries
5. Apply the aggregate functions and get the result using select queries.
6. Close MYSQL App
Result:
The above MYSQL statements are executed successfully
Ex.No:5 Write MYSQL queries to join two tables (Inner join, Outer
join).
Aim:
To create a queries to join two tables.
Algorithm:
1. Open MYSQL WORKBENCH8.0 CE
2. Connect to MYSQL Using Password :kgac@123
3. Create a shop database and create table customer and order using
create table queries.
4. Insert the values in that table using insert queries
5. Join the table using INNER JOIN, LEFT OUTER JOIN and RIGHT OUTER
JOIN in select queries.
6. Close MYSQL App
Result:
The above MYSQL statements are executed successfully
Ex.No:6 Write MYSQL statement to create a new user and set a
password and privileges for an existing database.
Aim:
To create a new user and set a password and privileges for an existing
database.
Algorithm:
1. Open MYSQL WORKBENCH8.0 CE
2. Connect to MYSQL Using Password :kgac@123
3. Use MYSQL database and select the users using select queries.
4. Create a new user along with username and password.
5. Grant privileges to new user using Grant statement.
6. View and revoke privileges using show and revoke queries.
7. Close MYSQL App
Result:
The above MYSQL statements are executed successfully

Ex.No:7 Write MYSQL statement to get name of the student


containing exactly four characters and determine the age of each of
the students.
Aim:
To get name of the student containing exactly four characters and
determine the age of each of the students.

Algorithm:
1. Open MYSQL WORKBENCH8.0 CE
2. Connect to MYSQL Using Password :kgac@123
3. Create a college database and create table student_data using create
table queries.
4. Insert the values in that table using insert queries
5. Select name of the student containing exactly four characters using
like operator and determine the age of each of the students using
TIMESTAMP FUNCTION.
6. Close MYSQL App
Result:
The above MYSQL statements are executed successfully

Ex.No:8 Write MYSQL statement for rollback, commit and save


option.
Aim:
To create a statement for rollback, commit and save option.
Algorithm:
1. Open MYSQL WORKBENCH8.0 CE
2. Connect to MYSQL Using Password :kgac@123
3. Create a shop database and create table Books using create table
queries.
4. Start the transaction and Insert the values in that table using insert
queries
5. Set the save point and Insert the values in that table using insert
queries
6. Set rollback to previous save point.
7. Insert the values in that table using insert queries and commit the
transaction.
8. View the table using select queries.
9. Close MYSQL App
Result:
The above MYSQL statements are executed successfully

You might also like