SNHU DAD 220 EXAM SCRIPT QUESTIONS AND SOLUTIONS
2025/2026 RATED A+
✔✔what does the string function SUBSTRING(s, pos, len) do? - ✔✔Returns the
substring from s that starts at position pos and has length len
ex. SELECT SUBSTRING("Boomerang", 1, 4);
returns 'Boom'
✔✔What does the string function TRIM(s) do? - ✔✔returns the string s without leading
and trailing spaces
ex. SELECT TRIM(" test ");
returns 'test'
✔✔What does the string function UPPER(s) do? - ✔✔Returns the uppercase s
✔✔What does the date and time function CURDATE() CURTIME() NOW() do? -
✔✔Returns the current date, time, or date and time in 'YYYY-MM-DD', 'HH:MM:SS',
or'YYYY-MM-DD HH:MM:SS' format
✔✔What does the date and time function DATE(expr) TIME(expr) do? - ✔✔Extracts the
date or time from a date or datetimeexpression expr
ex. SELECT DATE('2013-03-25 22:11:45');
returns '2013-03-25'
SELECT TIME('2013-03-25 22:11:45');
returns '22:11:45'
✔✔What does the date and time function DAY(d) MONTH(d) YEAR(d) do? -
✔✔Returns the day, month, or year from date d
ex. SELECT DAY('2016-10-25');
returns 25
SELECT MONTH('2016-10-25');
returns 10
SELECT YEAR('2016-10-25');
returns 2016
✔✔What does the date and time function HOUR(t) MINUTE(t) SECOND(t) do? -
✔✔Returns the hour, minute, or second from time t
ex. SELECT HOUR('22:11:45');
returns 22
SELECT MINUTE('22:11:45');
, returns 11
SELECT SECOND('22:11:45');
returns 45
✔✔What does the date and time function DATEDIFF(expr1, expr2) TIMEDIFF(expr1,
expr2) do? - ✔✔Returns expr1 - expr2 in number of days or timevalues, given expr1
and expr2 are date, time, or datetime values
ex. SELECT DATEDIFF('2013-03-10', '2013-03-04');
returns 6
SELECT TIMEDIFF('10:00:00', '09:45:30');
returns 00:14:30
✔✔data query language (DQL) - ✔✔extracts data from and about the database
✔✔The SHOW statement - ✔✔shows information about databases, tables, columns,
and server status information
Common examples
SHOW DATABASES lists databases available in the database system.
SHOW TABLES lists tables available in the currently selected database.
SHOW COLUMNS lists columns available in a specific table named by a FROM clause.
SHOW CREATE TABLE shows the CREATE TABLE statement for a given table.
✔✔The SELECT statement - ✔✔retrieves data from a table
✔✔Result set - ✔✔data returned from the SELECT statement, stored in a result table
✔✔The WHERE clause - ✔✔combined with the SELECT statement to filter the result
set. The WHERE clause must come after the FROM clause.
✔✔Condition - ✔✔expression that evaluates to TRUE, FALSE, or NULL. Only a
condition that is TRUE selects the row. Uses a comparison operator
✔✔When will a comparison operator evaluate to NULL? - ✔✔When one or both
operands are NULL. Ex: NULL > 1000 is NULL.
✔✔Logical operators - ✔✔AND, OR, AND NOT
✔✔What specifies which logical operators are evaluated first? - ✔✔Parenthesis, if none
AND is evaluated first
✔✔How do logical operators evaluate to NULL? - ✔✔TRUE AND NULL is NULL, but
FALSE AND NULL is FALSE.
2025/2026 RATED A+
✔✔what does the string function SUBSTRING(s, pos, len) do? - ✔✔Returns the
substring from s that starts at position pos and has length len
ex. SELECT SUBSTRING("Boomerang", 1, 4);
returns 'Boom'
✔✔What does the string function TRIM(s) do? - ✔✔returns the string s without leading
and trailing spaces
ex. SELECT TRIM(" test ");
returns 'test'
✔✔What does the string function UPPER(s) do? - ✔✔Returns the uppercase s
✔✔What does the date and time function CURDATE() CURTIME() NOW() do? -
✔✔Returns the current date, time, or date and time in 'YYYY-MM-DD', 'HH:MM:SS',
or'YYYY-MM-DD HH:MM:SS' format
✔✔What does the date and time function DATE(expr) TIME(expr) do? - ✔✔Extracts the
date or time from a date or datetimeexpression expr
ex. SELECT DATE('2013-03-25 22:11:45');
returns '2013-03-25'
SELECT TIME('2013-03-25 22:11:45');
returns '22:11:45'
✔✔What does the date and time function DAY(d) MONTH(d) YEAR(d) do? -
✔✔Returns the day, month, or year from date d
ex. SELECT DAY('2016-10-25');
returns 25
SELECT MONTH('2016-10-25');
returns 10
SELECT YEAR('2016-10-25');
returns 2016
✔✔What does the date and time function HOUR(t) MINUTE(t) SECOND(t) do? -
✔✔Returns the hour, minute, or second from time t
ex. SELECT HOUR('22:11:45');
returns 22
SELECT MINUTE('22:11:45');
, returns 11
SELECT SECOND('22:11:45');
returns 45
✔✔What does the date and time function DATEDIFF(expr1, expr2) TIMEDIFF(expr1,
expr2) do? - ✔✔Returns expr1 - expr2 in number of days or timevalues, given expr1
and expr2 are date, time, or datetime values
ex. SELECT DATEDIFF('2013-03-10', '2013-03-04');
returns 6
SELECT TIMEDIFF('10:00:00', '09:45:30');
returns 00:14:30
✔✔data query language (DQL) - ✔✔extracts data from and about the database
✔✔The SHOW statement - ✔✔shows information about databases, tables, columns,
and server status information
Common examples
SHOW DATABASES lists databases available in the database system.
SHOW TABLES lists tables available in the currently selected database.
SHOW COLUMNS lists columns available in a specific table named by a FROM clause.
SHOW CREATE TABLE shows the CREATE TABLE statement for a given table.
✔✔The SELECT statement - ✔✔retrieves data from a table
✔✔Result set - ✔✔data returned from the SELECT statement, stored in a result table
✔✔The WHERE clause - ✔✔combined with the SELECT statement to filter the result
set. The WHERE clause must come after the FROM clause.
✔✔Condition - ✔✔expression that evaluates to TRUE, FALSE, or NULL. Only a
condition that is TRUE selects the row. Uses a comparison operator
✔✔When will a comparison operator evaluate to NULL? - ✔✔When one or both
operands are NULL. Ex: NULL > 1000 is NULL.
✔✔Logical operators - ✔✔AND, OR, AND NOT
✔✔What specifies which logical operators are evaluated first? - ✔✔Parenthesis, if none
AND is evaluated first
✔✔How do logical operators evaluate to NULL? - ✔✔TRUE AND NULL is NULL, but
FALSE AND NULL is FALSE.