1.
The subquery is never executed. Only the main query is executed.
2.
They are executed at the same time
3.
the main query
4.
the subquery
Q 1 / 96
1.
mysqlexport
2.
mysqladmin
3.
mysqldump
4.
mysqld
Q 2 / 96
1.
row level
2.
database level
3.
column level
4.
function level
Q 3 / 96
1.
--options
2.
?
3.
--help
4.
-h
Q 4 / 96
1.
DIR
2.
HOME
3.
PATH
4.
MYSQL_HOME
Q 5 / 96
1 CREATE PROCEDURE P () AS 2 BEGIN 3 END; 1 CREATE PROCEDURE P () 2 BEGIN 3 END 1 CREATE PROCP 2 BEGIN 3 END; 1 CREATE PROC P AS O 2 BEGIN 3 END;
1.
A
2.
B
3.
C
4.
D
Q 6 / 96
1.
ENUM
2.
OTEXT
3.
VARCHAR
4.
LONGTEXT
Q 7 / 96
1 CREATE TABLE employee ( 2 employee ID char(10), 3 firstName varchar(50), 4 lastName varchar(50), 5 phone varchar(20), 6 address varchar(50), 7 PRIMARY KEY ON employeeID 8 ); 1 CREATE TABLE employee ( 2 employee ID char(10), 3 firstName varchar(50), 4 lastName varchar(50), 5 phone varchar(20), 6 address varchar(50), 7 PRIMARY KEY employeeID 8 ); 1 CREATE TABLE IF EXISTS employee ( 2 employee ID char(10), 3 firstName varchar(50), 4 lastName varchar(50), 5 phone varchar(20), 6 address varchar(50), 7 PRIMARY KEY (employeeID) 8 ); sql 1 CREATE TABLE IF NOT EXISTS employee ( 2 employee ID char(10), 3 firstName varchar(50), 4 lastName varchar(50), 5 phone varchar(20), 6 address varchar(50), 7 PRIMARY KEY (employeeID) 8 );
1.
A
2.
B
3.
C
4.
D
Q 8 / 96
![mysql Q09](images/mysql_q09.jpg)
1.
LIKE
2.
IN
3.
BETWEEN
4.
HAVING
Q 9 / 96
1.
USE db
2.
SELECT column FROM tbl
3.
SHOW COLUMNS FROM tbl
4.
SHOW TABLES
Q 10 / 96
`Logical, physical and normalized are all products of the designing phase in this order.`
1.
system definition
2.
logical model
3.
physical model
4.
normalized database
Q 11 / 96
1.
TRADITIONAL
2.
ANSI
3.
MSSQL
4.
STRICT
Q 12 / 96
1.
database and programming
2.
user and administrator
3.
client and server
4.
syntax and objects
Q 13 / 96
1.
INFO table;
2.
SHOW table;
3.
STRUCTURE table;
4.
DESCRIBE table;
Q 14 / 96
1.
administrator schema
2.
encrypted algorithms
3.
user settings
4.
access control lists
Q 15 / 96
1.
UPDATE
2.
MODIFY
3.
CHANGE
4.
ALTER
Q 16 / 96
1.
a SQL query using partitions
2.
a SQL query using IS NULL
3.
a SQL query using a regular expression
4.
a SQL query using LTRIM Or RTRIM
Q 17 / 96
1.
line break
2.
colon
3.
semicolon
4.
period
Q 18 / 96
1.
DELETE
2.
DELETE FROM
3.
REMOVE
4.
REMOVE FROM
Q 19 / 96
1.
GROUP_BY
2.
WHERE
3.
LIMIT
4.
LIKE
Q 20 / 96
`SELECT * FROM Employees WHERE EmployeeName LIKE 'a%'`
1.
It records in the Employees table where the value in the EmployeeName column doesn't have an "a".
2.
It records in the Employees table where the value in the EmployeeName column starts with "a".
3.
It records in the Employees table where the value in the EmployeeName column has an "a".
4.
It records in the Employees table where the value in the EmployeeName column ends with "a".
Q 21 / 96
1.
a SQL query
2.
a SQL statement
3.
a database
4.
a table
Q 22 / 96
1.
SQL is a standard language for retrieving and manipulating data from structured databases. MySQL is a nonrelational database management system that is used to manage SQL databases.
2.
SQL is a standard language for retrieving and manipulating data from structured databases. MySQL is a relational database management system that is used to manage SQL databases.
3.
They are not different. MySQL and SQL refer to the same thing.
4.
My SQL is a language, and SQL is a software application.
Q 23 / 96
1.
SELECT * FROM movies GROUP BY name
2.
SELECT * FROM movies ORDER BY name
3.
SELECT * FROM movies ORDER TABLE by name
4.
SELECT * FROM movies FILTER BY name
Q 24 / 96
1.
INSERT, UPDATE, DELETE
2.
CREATE, ALTER, DROP
3.
OPEN, FETCH, CLOSE
4.
DECLARE, SET, SELECT
Q 25 / 96
1.
UNIQUE
2.
LIMIT
3.
DISTINCT
4.
CONSTRAINT
Q 26 / 96
1.
25
2.
990
3.
0
4.
3306
Q 27 / 96
1.
DISTINCT
2.
WHERE
3.
LIMIT
4.
AS
Q 28 / 96
1.
They both refer to the same operation of deleting the table completely.
2.
They both refer to the same operation of clearing the table, but keeping its definition intact.
3.
TRUNCATE deletes table completely, removing its definition as well. DROP clears the table but does not delete the definition.
4.
DROP deletes table completely, removing its definition as well. TRUNCATE clears the table but does not delete the definition.
Q 29 / 96
1.
SELECT all FROM inventory;
2.
FROM inventory SELECT all;
3.
FROM inventory SELECT *;
4.
SELECT * FROM inventory;
Q 30 / 96
1.
set of triggers
2.
sequential id field
3.
minimum of three columns
4.
primary key
Q 31 / 96
1.
variable settings
2.
configuration files
3.
help files
4.
default settings
Q 32 / 96
1.
storage engine
2.
user accounts
3.
grant tables
4.
data directory
Q 33 / 96
1.
JOIN
2.
WITH HEADERS
3.
UNION
4.
WITH COLUMNS
Q 34 / 96
1.
remote-local
2.
parent-child
3.
master-slave
4.
logical-physical
Q 35 / 96
1.
the subquery must use an aggregate function.
2.
the subquery must refer to the same table as the main query.
3.
the subquery must return a single value.
4.
the subquery must return at least one value.
Q 36 / 96
1.
it performs a table check and, if problems are found, attempts a table repair.
2.
it stops and notifies the server administrator that the upgrade cannot complete until the incompatibility issue are resolved.
3.
it provides a full report of the table specifications and the incompatibilities to the server administrator.
4.
it performs a table check and, if problems are found, displays the information for the server administrator to take action.
Q 37 / 96
1.
show grants (displays the privileges and roles that are assigned to a MySQL user account or role)
2.
show privileges (shows the list of system privileges that the MySQL server supports)
3.
show access
4.
show user permissions
Q 38 / 96
1.
temporary
2.
system
3.
large
4.
new
Q 39 / 96
1.
inefficient for storing json documents
2.
cannot be indexed directly
3.
documents cannot be validated when stored in json columns
4.
cannot be normalized
Q 40 / 96
![mysql Q41](images/mysql_q41.jpg)
1.
carid is the primary key for purchases
2.
carid is the foreign key for cars.carid
3.
customerid is the foreign key for customers.id
4.
customerid is the primary key for purchases
Q 41 / 96
1.
cat file|mysql
2.
load data infile (correct if the file is already on the server)
3.
load data local infile (also correct but only if the file is from the client)
4.
extended insert statement
Q 42 / 96
![mysql Q43](images/mysql_q43.jpg)
1.
after insert
2.
if exists (invalid not a trigger; IF function + EXISTS clause)
3.
before insert
4.
cross join (valid for a check but not a trigger)
Q 43 / 96
('Mercedes', 'C', 2003) values ('Mercedes', 'C', 2003) ('Mercedes', 'C', 2003) ('Mercedes', 'C', 2003)
1.
insert into cars (make, model, year) values ('Ford', 'Mustang', 2002)
2.
insert into cars (make, model, year) values ('Ford', 'Mustang', 2002)
3.
insert into cars (make, model, year) extended ('Ford', 'Mustang', 2002),
4.
insert into cars (make, model, year) values ('Ford', 'Mustang', 2002),
Q 44 / 96
Note that the question is about _getting_ the data and not about the _duplicating_ operation itself. And actually there is no need to run `SHOW CREATE TABLE` at all. [To duplicate the table](https://popsql.com/learn-sql/mysql/how-to-duplicate-a-table-in-mysql) structure you can `CREATE TABLE new_table LIKE original_table;`.
1.
create table
2.
clone table
3.
insert into
4.
show create table
Q 45 / 96
1.
Run MySQL server as a normal user.
2.
Grant PROCESS or SUPER privilege to other users.
3.
Run MySQL server as the unix root user.
4.
Use the compressed protocol.
Q 46 / 96
1.
`create temporary table customers;`
2.
`drop temp table customers;`
3.
`drop table customers;`
4.
`drop temporary table customers;`
Q 47 / 96
This is exactly what [WITH clause](https://dev.mysql.com/doc/refman/8.0/en/with.html) is designed for
1.
COLLATE
2.
UNION
3.
FULL JOIN
4.
WITH
Q 48 / 96
1.
merge
2.
updatable
3.
temptable
4.
undefined
Q 49 / 96
Note: perror prints a description for a system error code or for a storage engine (table handler) error code -
1.
to display your version of MySQL
2.
to display operating system error codes
3.
to display default settings that are in error
4.
to display storage error codes
Q 50 / 96
Note: `DESCRIBE tablename` is a shortcut for this command
1.
SHOW table COLUMNS;
2.
SHOW COLUMNS FROM table;
3.
LIST table COLUMNS;
4.
SELECT COLUMNS FROM table;
Q 51 / 96
1.
SELECT * FROM DATABASE;
2.
SHOW TABLES;
3.
LIST TABLES;
4.
SELECT ALL TABLES;
Q 52 / 96
1.
CHECK TABLE;
2.
CREATE TABLE;
3.
ANALYZE TABLE;
4.
OPTIMIZE TABLE;
Q 53 / 96
1.
mysql.accounts;
2.
mysql.passwords;
3.
mysql.admin;
4.
mysql.user;
Q 54 / 96
1.
primary key;
2.
secondary key;
3.
foreign key;
4.
alternate key;
Q 55 / 96
1.
WITH (SELECT id FROM users) as cte, SELECT ...
2.
WITH (SELECT id FROM users) as cte SELECT ...
3.
WITH cte as (SELECT id FROM users), SELECT ...
4.
WITH cte as (SELECT id FROM users) SELECT ...
Q 56 / 96
Note: "to make the system faster" can also be correct. For example we can calculate some heavy query in advance and store its result in some column (use it as a cache). So if "system" means "application which uses mysql" then it's correct too.
1.
to reduce corruption in data
2.
to reduce storage space
3.
to make the system faster
4.
to prevent data anomalies
Q 57 / 96
mysql LOAD XML LOCAL INFILE 'cars.xml' INTO TABLE cars ROWS IDENTIFIED BY `<car>`; xml <car> <field name="make"> Lexus </field> <field name="model"> IS300 </field> <field name="make"> 2016 </field> </car> xml <car name="make"> Dodge </car> <car name="model"> Ram </car> <car name="year"> 2000 </car> xml <car make="Ford" model="Mustang" year="2002"/> xml <car year="2010"> <make>Mercedes</make> <model> C-Class</model> </car>
1.
A
2.
B
3.
C
4.
D
Q 58 / 96
1.
`INSERT IGNORE`
2.
`INSERT UNIQUE`
3.
`INSERT INTO`
4.
`INSERT DISTINCT`
Q 59 / 96
Note: both answers are correct - see [TRUNCATE TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/truncate-table.html) in MySQL manual
1.
It will stop and issue an error when it encounters a row that is referenced by a row in a child table.
2.
It always first drops, then re-creates a new table.
3.
It deletes rows one by one on tables with foreign key constraints.
4.
It does not invoke the `DELETE` triggers associated with the table.
Q 60 / 96
![mysql Q61](images/mysql_q61.png) Explanation: THe difference between 2 and 3 is that LEFT JOIN will return 1 row per customer before grouping. If replaced with RIGHT JOIN it would return the correct info.
1.
`SELECT state, COUNT(*) FROM customers WHERE ID IN (SELECT customerID FROM purchases) GROUP BY state;`
2.
`SELECT state, COUNT(*) FROM customers c LEFT JOIN purchases p ON c.ID = p.customerID GROUP BY state;`
3.
`SELECT state, COUNT(*) FROM customers c, purchases p WHERE c.ID = p.customerID GROUP BY state;`
4.
`SELECT state, COUNT(*) FROM customers GROUP BY state;`
Q 61 / 96
1.
`DELETE DUPS`
2.
`DELETE DISTINCT`
3.
`DELETE JOIN`
4.
`DELETE WITH`
Q 62 / 96
1.
`DEFAULT` value
2.
`RETURN` variable
3.
`SQLEXCEPTION` routine
4.
`NOT FOUND` handler
Q 63 / 96
1.
snapshot
2.
logical
3.
differential
4.
incremental
Q 64 / 96
1.
`mysqld`
2.
`mysql`
3.
`mysqladmin`
4.
`mysqldump`
Q 65 / 96
Note: the last option is valid too but the results will be enclosed with quotation marks
1.
`SELECT city FROM json_data;`
2.
`SELECT city->>'$.name' city FROM json_data;`
3.
`SELECT city.name city FROM json_data;`
4.
`SELECT city->'$.name' city FROM json_data;`
Q 66 / 96
1.
ENGINE
2.
PARTITION
3.
STORAGE
4.
TABLESPACE
Q 67 / 96
Table name: customers | ID | lastname | firstname | phone | address | city | state | zip | | ---- | -------- | --------- | ------------ | ------------------- | ----------- | ----- | ----- | | A001 | Smith | Bob | 212-555-1212 | 1001 1st Street | New York | NY | 10001 | | A002 | Chang | John | 213-555-5678 | 888 Rodeo Drive | Los Angeles | CA | 90210 | | A003 | Smith | Mary | 999-999-9999 | 123 Main Street | Anytown | VA | 12345 | | A004 | Johnson | Jack | 312-312-3120 | 1111 Chicago Avenue | Chicago | IL | 60606 | | A005 | Lopez | Linda | 737-777-3333 | 123 Main Street | Austin | TX | 73344 | sql SELECT * FROM customers WHERE address MATCH 'Street' OR 'Drive'; sql SELECT * FROM customers WHERE MATCH(address) IN ('street, drive'); sql SELECT * FROM customers WHERE address MATCH 'Street' OR address MATCH 'Drive'; sql SELECT * FROM customers WHERE MATCH(address) AGAINST ('street, drive');
1.
A
2.
B
3.
C
4.
D
Q 68 / 96
1.
SHOW DATABASES;
2.
LIST ALL DATABASES;
3.
LIST DATABASES;
4.
SHOW DB;
Q 69 / 96
1.
all tables, columns, data types, indexes and their relationships
2.
a list of entities, their relationship, and constraints
3.
all tables and their names, which are needed to implement the logical model
4.
a list of entities, their relationship, constraints, data types, and cardinalities
Q 70 / 96
1.
INOUT
2.
IN
3.
OUT
4.
IN OUT
Q 71 / 96
1.
The temporary table will be dropped when the database is restarted.
2.
Temporary tables can be shared among clients, which makes them more usable in group development environments.
3.
The temporary table will be dropped as soon as your session disconnects.
4.
Creating a temporary table does not require any special privileges.
Q 72 / 96
1.
`public construct User() {}`
2.
`public User() {}`
3.
`public instance User() {}`
4.
`public init User() {}`
Q 73 / 96
1.
2
2.
4
3.
8
4.
16
Q 74 / 96
1.
`DISPLAY TRIGGERS;`
2.
`SHOW TRIGGERS;`
3.
`SELECT ALL TRIGGERS;`
4.
`SELECT * FROM information_schema.triggers;`
Q 75 / 96
1.
TIMESTAMP values require more bytes for storage than DATETIME values.
2.
TIMESTAMP is stored without timezone, and DATETIME is stored in UTC values.
3.
TIMESTAMP and DATETIME are both stored without time zone.
4.
TIMESTAMP is stored in UTC values, and DATETIME is stored in without time zone.
Q 76 / 96
1.
`mysqladmin flush-threads`
2.
`mysqladmin flush-tables`
3.
`mysqladmin flush-privileges`
4.
`mysqladmin flush-all`
Q 77 / 96
1.
Stored procedures are not secure, because they can be executed from the command line as the root user
2.
Stored procedures are secure, because the owner of the stored procedure can decide to whom access is granted
3.
Stored procedures are secure, because applications can be given access to stored procedures and not any underlying variables
4.
Stored procedures are not secure, because they can execute statements to drop tables or bulk delete data
Q 78 / 96
1.
`SELECT * FROM customers WHERE PhoneNumber = NULL;`
2.
`SELECT * FROM customers WHERE PhoneNumber IS NOT VALID;`
3.
`SELECT * FROM customers WHERE PhoneNumber IS NULL;`
4.
`SELECT * FROM customers WHERE PhoneNumber IS UNKNOWN;`
Q 79 / 96
![mysql picture](images/mysql_q80.png)
1.
FLOAT
2.
DECIMAL(10,2)
3.
NUMERIC
4.
DOUBLE
Q 80 / 96
Explnation: BIT is not a string type
1.
`ENUM`
2.
`SET`
3.
`BIT`
4.
`CHAR`
Q 81 / 96
![mysql picture](images/mysql_q80.png)
1.
one-to-many
2.
parent-child
3.
many-to-many
4.
many-to-one
Q 82 / 96
Explanation: Both `SET` and `DECLARE` are used to create variables. Reference: [MySQL STORED PROCEDURE Tutorial With Examples](https://www.softwaretestinghelp.com/mysql-stored-procedure/)
1.
`SELECT`
2.
`USE`
3.
`SET`
4.
`DECLARE`
Q 83 / 96
1.
trigger
2.
regular expression
3.
view
4.
index
Q 84 / 96
![mysql picture](images/mysql_q85.png)
1.
The ID field needs to include letters and not just numbers.
2.
You can have a consistent format across all of the tables that require ID fields.
3.
The ID field needs to have leading 0s, which the INT data type would truncate.
4.
The `CHAR(10)` data type is more efficient and space-saving.
Q 85 / 96
Explanation: CTEs do not create temporary tables, they only work within a signle query. Reference: [13.2.15 WITH (Common Table Expressions)](https://dev.mysql.com/doc/refman/8.0/en/with.html).
1.
To define queries for later reuse for the duration of the current session
2.
To create temporary tables that can be used to pre-select often-used result sets.
3.
To calculate a new single value from a result set and return it to the query parser.
4.
To break down complex queries and allow reuse within a query.
Q 86 / 96
Reference: [4.2.2.4 Program Option Modifiers](https://dev.mysql.com/doc/refman/8.0/en/option-modifiers.html)
1.
--verbose
2.
--skip
3.
--skip-error
4.
--loose
Q 87 / 96
SELECT name FROM students WHERE name REGEXP '^to';
1.
all names starting with "to," such as Tommy or Tony
2.
all names with "to," such as Roberto and Tommy
3.
all names without "to," such as Samantha or Kathryn
4.
all names ending with "to," such as Roberto
Q 88 / 96
![mysql picture](images/mysql_q92.png)
1.
UNION
2.
SHOW TOTALS
3.
UNION ALL
4.
WITH ROLLUP
Q 89 / 96
1.
Inner Join
2.
Natural Join
3.
Outer Join
4.
Cartesian Join
Q 90 / 96
1.
`CREATE VIEW v1 SELECT * FROM t1 WHERE col1 > 10;`
2.
`CREATE VIEW v1 AS BEGIN SELECT * FROM t1 END;`
3.
`CREATE VIEW v1 BEGIN SELECT * FROM t1 END;`
4.
`CREATE VIEW v1 AS SELECT * FROM t1;`
Q 91 / 96
1.
encrypted algorithms
2.
access control lists
3.
user settings
4.
administrator schema
Q 92 / 96
1.
`UNDO`
2.
`UNCOMMIT`
3.
`ROLLBACK`
4.
`REVERSE
Q 93 / 96
1.
DATE()
2.
GETDATE()
3.
CURDATE()
4.
CURRENT()
Q 94 / 96
1.
`Create table size (ENUM ('Small','Medium','Large'));`
2.
`Create table ENUM (name ('Small','Medium','Large'));`
3.
`Create table size (name: ENUM['Small','Medium','Large']);`
4.
`Create table size (name ENUM('Small','Medium','Large'));`
Q 95 / 96
![mysql picture](images/mysql_q92.png)
1.
`IF EXISTS`
2.
`AFTER INSERT`
3.
`BEFORE INSERT`
4.
`CROSS JOIN`
Q 96 / 96