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

VR DBMS EXPT-3

The document outlines basic SQL operations including Create, Insert, Update, Delete, and Select statements for two scenarios: a Bank and a College. It provides syntax and examples for creating tables, inserting records, updating existing records, deleting records, and selecting data from the tables. The examples illustrate how to manage data for both a Bank and a College using SQL commands.
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)
11 views

VR DBMS EXPT-3

The document outlines basic SQL operations including Create, Insert, Update, Delete, and Select statements for two scenarios: a Bank and a College. It provides syntax and examples for creating tables, inserting records, updating existing records, deleting records, and selecting data from the tables. The examples illustrate how to manage data for both a Bank and a College using SQL commands.
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/ 10

Name:- Vaibhav Rawat

Class:- Btech AIDS (4th Sem)

Roll No. :- 35318011923

EXPERIMENT- 3
Aim:- Implement basic queries to Create, Insert, Update, Delete and Select
Statements for two different scenarios (Bank and College)
1. Create :- It is use to create new tables and databases
Syntax:-
CREATE TABLE table_name (
column1_name column1_data_type,
column2_name column2_data_type,
...
[CONSTRAINTS] );

Example:- (A) For Bank Table

CREATE TABLE bank (


b_id INT PRIMARY KEY,
Name VARCHAR(20),
Age INT
Balance DECIMAL(10, 2) );

OUTPUT:-
(B) For College Table

CREATE TABLE College (


Student_id INT PRIMARY KEY,
Student_name VARCHAR(20),
Course VARCHAR(20),
Age INT );

OUTPUT:-

2. Insert :- It is used to add a new record or tuple in an existing table


Syntax:-
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);

Example:-(A) For Bank Table

INSERT INTO Bank (b_id, Name, Age, Balance)


VALUES (1, 'Vaibhav Rawat', 20, 10000.00);

INSERT INTO Bank (b_id, Name, Age, Balance)


VALUES (2, 'Piyush Bhatia', 19, 600.00);
INSERT INTO Bank (b_id, Name, Age, Balance)
VALUES (3, 'Saksham Pandey', 20, 55,000.00);

INSERT INTO Bank (b_id, Name, Age, Balance)


VALUES (4, 'Divytosh Upadhyay', 20, 50000.00);

INSERT INTO Bank (b_id, Name, Age, Balance)


VALUES (5, 'Arun Bharadwaj', 23, 100.00);

OUTPUT:-

(B) For College Table

INSERT INTO College (Student_id, Student_name, Course, Age)


VALUES (1, 'Vaibhav Rawat', 'Btech', 20);

INSERT INTO College (Student_id, Student_name, Course, Age)


VALUES (2, 'Piyush Bhatia', 'BBA', 19);
INSERT INTO College (Student_id, Student_name, Course, Age)
VALUES (3, 'Saksham Pandey', 'Btech', 20);

INSERT INTO College (Student_id, Student_name, Course, Age)


VALUES (4, 'Divytosh Upadhyay', 'BCA', 20);

INSERT INTO College (Student_id, Student_name, Course, Age)


VALUES (5, 'Arun Bharadwaj', 'LLB', 23);

OUTPUT:-

3. Update :-It is used to update an existing record in a table

Syntax:-

UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Example:- (A) For Bank Table:-

UPDATE Bank
SET Name = 'Rajveer Rawat'
WHERE b_id = 1;

OUTPUT:-

(B) For College Table

UPDATE College
SET Student_Name = 'Rajveer Rawat'
WHERE Student_id = 1;
OUTPUT:-
4. Delete :- It is used to deleting a record from the table.

Syntax:-
DELETE FROM table_name
WHERE condition;

Example:- (A) For Bank Table

DELETE FROM Bank


WHERE b_id = 5;

OUTPUT:-

(B) For College Table

DELETE FROM College


WHERE Student_id = 5;
OUTPUT:-

5. Select :-It is used to select rows from the table.

Syntax:-

SELECT column1, column2, ...


FROM table_name
WHERE condition;

Example:- (A) For Bank Table

(a)SELECT * FROM Bank;

OUTPUT:-
(b) SELECT

SELECT b_id, Name, Balance FROM Bank


WHERE Age=20;

OUTPUT:-

(B) For College Table

(a)SELECT * FROM College;

OUTPUT:-

(b) SELECT Student_id, Student_name, Course FROM College


WHERE Age=20;

OUTPUT:-

You might also like