1. 1. Which of the following correctly creates a table named Students with columns ID (integer)
and Name (varchar of length 50)?
A) CREATE TABLE Students (ID int, Name varchar(50));
B) CREATE TABLE Students (ID integer, Name varchar[50]);
C) CREATE Students TABLE (ID int, Name varchar(50));
D) CREATE TABLE Students: ID int, Name varchar(50);
2. To add a new column Age of type integer to an existing table Students, which of the following
is correct?
A) ALTER TABLE Students ADD COLUMN Age int;
B) ALTER Students TABLE ADD COLUMN Age integer;
C) ALTER TABLE Students ADD Age integer;
D) MODIFY TABLE Students ADD Age int;
3. What is the correct syntax to add a PRIMARY KEY constraint on the ID column in the table
Students (assuming it's already created)?
A) ALTER TABLE Students ADD PRIMARY KEY (ID);
B) ALTER TABLE Students MODIFY ID PRIMARY KEY;
C) ALTER Students ADD CONSTRAINT PRIMARY KEY ID;
D) ADD PRIMARY KEY (ID) TO TABLE Students;
4. To create a table Courses with CourseID as primary key and CourseName as varchar, which
is correct?
A) CREATE TABLE Courses (CourseID int PRIMARY KEY, CourseName varchar(100));
B) CREATE TABLE Courses (CourseID int, PRIMARY KEY CourseID, CourseName
varchar(100));
C) CREATE TABLE Courses (CourseID PRIMARY KEY int, CourseName varchar(100));
D) CREATE TABLE Courses CourseID int PRIMARY KEY, CourseName varchar(100);
5. Which of the following is the correct way to add a NOT NULL constraint to the column Name
in the Students table?
A) ALTER TABLE Students MODIFY Name varchar(50) NOT NULL;
B) ALTER TABLE Students ALTER COLUMN Name SET NOT NULL;
2. C) ALTER TABLE Students ADD CONSTRAINT NOT NULL(Name);
D) ALTER Students SET NOT NULL FOR Name;
Answer: B (Note: Syntax can vary slightly based on DBMS — B works for PostgreSQL, A for
MySQL)