0% found this document useful (0 votes)
45 views3 pages

Practical-2 Dbms

The document outlines the steps to create a Visitor Management Database using MySQL. It includes instructions for creating a database and table, inserting data, retrieving table structure, deleting duplicate records, and updating values. Example commands are provided for each step to guide the user through the process.

Uploaded by

aryan456bhatia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views3 pages

Practical-2 Dbms

The document outlines the steps to create a Visitor Management Database using MySQL. It includes instructions for creating a database and table, inserting data, retrieving table structure, deleting duplicate records, and updating values. Example commands are provided for each step to guide the user through the process.

Uploaded by

aryan456bhatia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DBMS

Practical-2
CASE STUDY-2 Visitor_Management Database.

 Step-1 Create database of visitor management in Mysql.

Syntax- CREATE DATABASE <DATABASE_NAME>

EX-CREATE DATABASE visitor_management;

and with help of [SHOW COMMAND] WE CAN SEE THE DATABASE

 Step-2 Then we have to create table in the database.

Syntax-CREATE TABLE <table_name>(<column1><datatype> <size>,

<column2><datatype><size>);

Ex-CREATE TABLE visitor_user (

id int(11) UNSIGNED NOT NULL,

first_name varchar(255) DEFAULT NULL,

last_name varchar(255) DEFAULT NULL,

gender enum('Male','Female') NOT NULL,

email varchar(255) DEFAULT NULL,

password varchar(64) NOT NULL,

1
mobile int(12) NOT NULL,

status enum("In","Out"));

 Step-3 Now we will retrieve the structure of the table by DESC or DESCRIBE.

Syntax-Desc <table_name>

Ex-Desc visitor_user

 Step-4 So, now we are inserting the data in the tables.

Syntax-INSERT INTO <table_name> values(<values1>,<values2>,<values3>,<values4>);

Ex-insert into visitor_user


values("1013","Arya","Malhotra","Female","[email protected]","77464","465872","In");

insert into visitor_user


values("1487","Vaibhav","Gupta","Male","[email protected]","7984456","136544","In")

insert into visitor_user


values("1034","abhi","singh","Male","[email protected]","90112","433437","Out");

insert into visitor_user


values("1034","abhi","singh","Male","[email protected]","90112","433437","Out");

Then write after entering the data

SELECT*FROM VISITOR_USER;

2
 Step-5 Deleting the duplicate records from the tables

Syntax- DELETE FROM <table_name> ,WHERE CONDITIONS;

Ex- Delete from visitor_user where= '1034';

 Step-6 Updating the table for different values;

Syntax- UPDATE <table_name> SET <column_name> , WHERE CONDITIONS;

Ex- update visitor_user set mobile="433437" where first_name="abhi";

You might also like