0% found this document useful (0 votes)
8 views2 pages

SQL Commands Exercise for Students

Uploaded by

kultaranytpro
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)
8 views2 pages

SQL Commands Exercise for Students

Uploaded by

kultaranytpro
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

SQL COMMANDS EXERCISE – 1

Ex. No: 20
Date:

Aim:
To Write Queries for the following Questions based on the given table:

Roll No Name Gender Age Dept DOA Fees


1 Arun M 24 COMPUTE 1997-01-10 120
R
2 Ankit M 21 HISTORY 1998-03-24 200
3 Anu F 20 HINDI 1996-12-12 300
4 Bala M 19 NULL 1999-07-01 400
5 Charan M 18 HINDI 1997-09-05 250
6 Deepa F 19 HISTORY 1997-06-27 300
7 Dinesh M 22 COMPUTE 1997-02-25 210
R
8 Usha F 23 NULL 1997-07-31 200

(a) Write a Query to create a new database in the name of “STUDENTS”.

CREATE DATABASE STUDENTS;


(b) Write a Query to Open the database “STUDENTS”.

USE STUDENTS;
(c) Write a Query to create the above table called: “STU"

CREATE TABLE STU(ROLLNO INT PRIMARY KEY,


NAME VARCHAR (10),
GENDER VARCHAR (3),
AGE INT,
DEPT VARCHAR (15),
DOA DATE,
FEES INT);
(d) Write a Query to list all the existing database names.

SHOW DATABASES;

(e) Write a Query to List all the tables that exists in the current database.

SHOW TABLES;
Output:

You might also like