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

SQL Questions

Uploaded by

neupaneroshni7
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)
13 views

SQL Questions

Uploaded by

neupaneroshni7
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/ 1

1.

Write SQL Queries for:

## create table student (student_id, name, gender, DOB, status, reg_date) with following constraints:
 student_id primary key,
 gender value as single character,
 status default value should be 1,
 reg_date default date from the system

## alter the student table to add contact number, this column can accept NULL values too

## display the student record with:


 name should be displayed as student name,
 gender should be displayed as MALE/FEMALE,
 DOB should be displayed in YYYY-MM-DD format

## update the record of the student whose name is ‘MINA’ and gender is ‘F’ to name = ‘MOHAN’ and
gender = ‘M’

## display the records of the students whose name starts with letter ‘man’ and gender = ‘M’

## display the records of the students whose contact number contain ‘570’ Or is NULL.

## display the total count of the students

## display the male/female count of the students.

## delete the students whose status is 0.

2. Write SQL Queries for:

## create table Project (project_id (PK), project_name, student_id (FK; can be NULL)).

## display the students and projects enrolled.

## alter the Project to increase the size of the column project_name to 100 character string.

## display the list of students who are not enrolled in any projects yet.

## count the number of students who are not enrolled in any projects yet.

## check whether any student is assigned to multiple projects

## Drop the tables Student & Project.

You might also like