Module 2-DBMS
Module 2-DBMS
MODULE 2
(a) For the above schema, set the data types along with constraints as per the following.
(Hint: You need not modify the schema of a table for this; you only need to define the given
data types with constraints (if any) at the time of the table's creation.)
1. For Roll_No field, set the data type as an Integer with PRIMARY KEY constraint. Moreover,
this field is auto-incremented. i.e., it will set the Roll_No. automatically from 1 to 5. You need
not insert any value in this field manually.
2. For Name field, set the data type as VARCHAR(20) with NOT NULL Constraint.
3. For Marks field, set the data type as an Integer with ‘CHECK’ constraint where marks (>=65
and <=90)
4. For City field, set the data type as VARCHAR(20).
5. For Gender field, set the data type as VARCHAR(20) with NOT NULL constraint.
6. For Branch field, set the data type as VARCHAR(20).
(b) By using the above schema perform the following SQL Queries.
1. Write a SQL query to insert the following into the table.
Roll_No Name Marks City Gender Branch
1 AJAY 70 Dehradun Male CSE
. VIVEK 65 Delhi Male CSE
. SIMMY 90 Dehradun Female ME
. MATT 76 Dehradun Male ECE
5 REENA 80 Mumbai Female CSE