wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

SQL Basics Worksheet

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which command is used to create a new database?

a)

USE

b)

CREATE DATABASE

c)

SHOW DATABASES

d)

CREATE TABLE

2.

To start working inside a specific database, we use:

a)

START DATABASE

b)

OPEN DATABASE

c)

USE

d)

SELECT DATABASE

3.

Which command displays all the tables present in the selected database?

a)

DISPLAY TABLES

b)

SHOW TABLES

c)

VIEW TABLES

d)

LIST TABLES

4.

In SQL, which data type is best suited for Fare (price of a flight)?

a)

INT

b)

VARCHAR

c)

DECIMAL

d)

DATE

5.

What is the correct syntax to create a table named Employees with the columns EmpID and Salary as integers?

a)

CREATE Employees TABLE (EmpID INT, Salary INT);

b)

CREATE TABLE Employees (EmpID, Salary);

c)

CREATE TABLE Employees (EmpID INT, Salary INT);

d)

TABLE Employees CREATE (EmpID INT, Salary INT);

6.

Which SQL statement is used to remove a database?

a)

DELETE DATABASE

b)

DROP DATABASE

c)

REMOVE DATABASE

d)

ERASE DATABASE

7.

What will the command SHOW DATABASES; do?

a)

Display all tables

b)

Display all records

c)

Display list of databases

d)

Show structure of a table

8.

Which keyword is used to define text columns such as EmpName or Author?

a)

TEXT

b)

WORD

c)

VARCHAR

d)

CHARACTERS

9.

Which command will show the structure of a table named Employees?

a)

SHOW Employees;

b)

DESCRIBE Employees;

c)

DETAIL Employees;

d)

VIEW Employees;

10.

What does this command do? CREATE TABLE Flights (FlightNo INT, AirlineName VARCHAR(20));

a)

Creates a new database

b)

Creates a new table

c)

Displays all flights

d)

Inserts values into Flights

11.

Which of the following is correct to create a table inside the selected database?

a)

You must select the database first

b)

You can create a table without selecting any database

c)

You must show tables first

d)

You must drop the database first

12.

To store numeric salary with decimals, which data type is best?

a)

INT

b)

DECIMAL

c)

CHAR

d)

BOOLEAN

13.

Which SQL keyword is mandatory when creating a database?

a)

NEW

b)

ADD

c)

CREATE

d)

OPEN

14.

What does the following command do? DROP TABLE Books;

a)

Deletes all databases

b)

Deletes Books table permanently

c)

Displays Books table

d)

Removes only data but keeps structure

15.

In the command CREATE TABLE Employees (EmpID INT, Salary INT); EmpID is:

a)

Column name

b)

Data type

c)

Database name

d)

Table name

16.

Which of the following is NOT a valid SQL statement?

a)

CREATE DATABASE MyDB;

b)

SHOW DATABASES;

c)

USE DATABASE MyDB;

d)

USE MyDB;

17.

Which of the following is a DDL (Data Definition Language) command?

a)

INSERT

b)

DELETE

c)

UPDATE

d)

CREATE

18.

What is the correct order of SQL statements for creating and using a database?

a)

CREATE TABLE → USE → CREATE DATABASE

b)

CREATE DATABASE → CREATE TABLE → USE

c)

USE → CREATE DATABASE → CREATE TABLE

d)

CREATE DATABASE → USE → CREATE TABLE

19.

Which datatype is suitable for storing prices such as Book Price?

a)

BOOLEAN

b)

DATE

c)

DECIMAL

d)

VARCHAR

20.

SQL stands for:

a)

Standard Query Language

b)

Simple Query Language

c)

Structured Query Language

d)

Server Query Language