DBMS Mysql Assignment 1&2
DBMS Mysql Assignment 1&2
ASSIGNMENT 1 & 2
1 - Insert 5-10 values for each table. Implement DDL and DML commands on
each table.
2 - put constraints as primary key for name, rollno in registration with
condition that semester would be >1, address will be restricted to himchal
pradesh and setting default value of stream as CSE/IT
3 - Access primary keys in fetch table fill the data in both tables by setting NOT
NULL constraints.
Implement and provide each query against each command with dropping or
altering constraints of table as well as records of table using DDl and DML.
Answer
use db1;
-- ** DML Queries ** --
2
add column Collage_Name varchar(50) after Branch ;
-- ** DML Queries ** --
insert into Fetch_data(Student_Name, Roll_No, Branch, ID, Age, Subject_1, Subject_2, Subject_3)
values
("Mohit Gautam", 191385,"Computer Science", 385, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
3
("Manan Mehta", 191386,"Computer Science", 386, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
("Sarthak Kumar", 191387,"Computer Science", 387, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
("Shaurya Awasthi", 191388,"Computer Science", 388, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
("Shreya Srivastava", 191389,"Computer Science", 389, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
("Arj Srivastava", 191390,"Computer Science", 390, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
("Achyut Tiwari", 191391,"Computer Science", 391, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
("Akshat Tripathi",191392,"Computer Science", 392, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
("Yash Bhradwaj",191398,"Computer Science", 398, 20,"Database Mangement System", "Model
Simulations & Technique", "Python"),
("Shubham Chaturvedi", 191408,"Computer Science", 408, 20,"Database Mangement System", "Model
Simulations & Technique", "Python")
;
update Registration_data
set Address = "Himachal Pradesh";
update Registration_data
set Collage_Name = "JUIT";
update Fetch_data
set Collage_Name = "JUIT";