The document describes three experiments related to working with databases in MySQL. Experiment 1 aims to store company data in a database table. It describes creating a table, defining columns and datatypes, and inserting data. Experiment 2 covers viewing and creating databases and tables, and inserting, updating, deleting records using commands like SELECT, INSERT, UPDATE, DELETE. Experiment 3 creates a table showing SQL functions used for data definition, manipulation, query, control and transactions.
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 ratings0% found this document useful (0 votes)
60 views8 pages
Dbms Experiments
The document describes three experiments related to working with databases in MySQL. Experiment 1 aims to store company data in a database table. It describes creating a table, defining columns and datatypes, and inserting data. Experiment 2 covers viewing and creating databases and tables, and inserting, updating, deleting records using commands like SELECT, INSERT, UPDATE, DELETE. Experiment 3 creates a table showing SQL functions used for data definition, manipulation, query, control and transactions.
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/ 8
Experiment-1
Aim: To store details of the company in the database which
includes employee name, salary and id.
To make this database, we followed few steps:
Firstly, we created a table named, employee. Using keyword create table. Then we wrote the names of the column with their datatypes. We inserted the details in the respective columns, using insert into followed by table name. We made use of select statement to fetch data from the database. On compiling, our data got printed in the form of a table. Experiment-2 Aim:1.) Perform the following on MySQL: a.) Viewing all databases, Creating a Database b.) Viewing all Tables in a Database, Creating simple tables 2.) Perform the following on MySQL: a.) Inserting/Updating/Deleting Records in Table b.) Saving (Commit,) and Undoing (rollback) 1.) a) Viewing all databases, Creating a database:
To view all databases, we used the keyword show followed by
databases, so that we can see all the databases present. To create a database, we used keyword create database along with database name. 1.)b) Viewing all Tables in a Database, Creating simple tables To view all tables, we used the keyword show followed by tables, so that we can see all the tables present.
To create a table, we used keyword create table along with
table name. 2.) a) Inserting/Updating/Deleting Records in Table i.) Inserting To insert into a table, we used keyword insert into along with table name. ii.) Updating
To update a table, we used keyword alter table followed by
table name followed by keyword add column/row along with the datatype. To Add data to the new column/row inserted use the command update with tablename, then followed by the keyword set along with column/row name followed by the value to be entered then use the keyword where with the primary key followed by the value of the primary key. iii.) Deleting
To delete a record from the table, we used keyword delete from
followed by table name followed by keyword where along with the primary key followed by the condition. Experiment-3 Aim: Create a table showing all the functions used in ddl, dml,dql,dcl and tcl.
Data Definition Language (DDL)- It is a subset of SQL
(Structured Query Language) responsible for defining and managing the structure of databases and their objects. Used to create, alter, and delete database objects like tables, indexes, etc. (CREATE, DROP, ALTER, RENAME, TRUNCATE) DQL (Data Query Language)- It is a subset of SQL focused on retrieving data from databases. Used to retrieve data from databases. (SELECT) Data Manipulation Language (DML)- In SQL encompasses commands that manipulate data within a database. DML allows you to insert, update, and delete records, ensuring the accuracy and currency of your data. Data Control Language(DCL)- It focuses on the management of access rights, permissions, and security- related aspects of a database system. DCL commands are used to control who can access the data, modify the data, or perform administrative tasks within a database. Transaction Control Language (TCL)- It deals with the management of transactions within a database. TCL commands are used to control the initiation, execution, and termination of transactions, which are sequences of one or more SQL statements that are executed as a single unit of work.