Set Exam Questions with Complete Answers
2024/2025
Create a brand-new table. - correct answer CREATE TABLE tableName (
column1 datatype,
column2 datatype,
column3 datatype
Delete an entire table along with all the table rows from a database. - correct answer
DROP TABLE tableName;
Data Type: Integer with range 0-255 - correct answer TINYINT UNSIGNED
Data Type: Integer with range 0-65,535 - correct answer SMALLINT UNSIGNED
Data Type: Integer with range 0-16,777,215 (16.8 million) - correct answer
MEDIUMINT UNSIGNED
Data Type: Integer with range 0 - 4,294,967,295 (4.3 billion) - correct answer
INTEGER UNSIGNED
can also use:
INT UNSIGNED
Data Type: Integer with range 0 - 2^64 -1 - correct answer BIGINT UNSIGNED
Data Type: Use for things like prices with a set number of decimal places. IE: A store
that sells items up to $10,000.00. - correct answer DECIMAL(M,D) where M = number
of significant digits
D= number of digits after decimal point.
,IE: Store with prices up to $10,000.00 would use
DECIMAL(7,2)
Data Type: Approximate decimal numbers with range -3.4E+38 to 3.4E+38 (uses only 4
bits of data) - correct answer FLOAT
Data Type: Approximate decimal numbers with range -1.8E+308 to 1.8E+308 (uses 8
bits of data) - correct answer DOUBLE
Data Type: Format 'YYYY-MM-DD' - correct answer DATE
Data Type: Format 'hh:mm:ss' - correct answer TIME
Data Type: Format 'YYYY-MM-DD hh:mm:ss' - correct answer DATETIME
Data Type: Fixed length string of N characters - correct answer CHAR(N)
Data Type: Variable length string up to N characters - correct answer VARCHAR(N)
After creating a table, this code is used to fill in the rows. Can also be used to add in
new rows later on. - correct answer INSERT INTO...VALUES
Example:
INSERT INTO tableName (column1Title, column2Title, ...)
VALUES (column1entry1, column2entry1,...),
(column1entry2, column2entry2,...),
(column1entry3, column2entry3,...);
, Select all columns from a table - correct answer SELECT *
FROM tableName;
Create a new database - correct answer CREATE DATABASE databaseName;
Delete an entire database and all associated tables. - correct answer DROP
DATABASE databaseName;
Lists all databases. - correct answer SHOW DATABASES;
Lists all tables in a particular database. - correct answer USE databaseName;
SHOW TABLES;
List all columns in a table from a database. - correct answer USE databaseName;
SHOW TABLES;
SHOW COLUMNS
FROM tableName;
Create a new column on an existing table. - correct answer ALTER TABLE tableName
Add columnName DataType;
Modify a column name or data type in an existing table. - correct answer ALTER
TABLE tableName
CHANGE columnName newColumnName newDataType;
Delete a column in an existing table. - correct answer ALTER TABLE
DROP columnName;