Segue apresentação de Ivan (DOWNLOAD APRESENTAÇÃO)
Pessoal segue exercício de hoje...
1. Is the following statement true or false?
InnoDB imposes no limit on the number of tables that can be held in the InnoDB tablespace.
A. Yes
B. No
2. Is the following statement true or false?
In a MySQL database, every table has an .frm file in the appropriate database directory, regardless of
the storage engine used
A. Yes
B. No
3. Consider the following table:
mysql> DESCRIBE t;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| i | int(11) | NO | PRI | | |
+-------+---------+------+-----+---------+-------+
Which statements can you use to drop a PRIMARY KEY?
A. DROP PRIMARY KEY
B. ALTER TABLE T DROP PRIMARY KEY
C. DROP PRIMARY KEY TABLE T;
4. Name the different kinds of indexes that MySQL supports
A. PRIMARY KEY, UNIQUE, INDEX (non-unique), FULLTEXT, and SPATIAL
B. PRIMARY KEY, UNIQUE, INDEX (non-unique)
C. PRIMARY KEY, UNIQUE
D.PRIMARY KEY, UNIQUE, INDEX (non-unique), FULLTEXT, and SPACIAL
5. What must be true of the columns named in a UNIQUE index for the index to be functionally equivalent
to a PRIMARY KEY on the same columns?
A. NOT NULL
B. INDEX
C. UNSIGNED NOT NULL
6. When you use DROP TABLE to remove a table, how do you tell MySQL not to report an error if the table doesn't exist?
A. DROP TABLE IF EXISTS tab
B. CROP TABLE CHECK tab
C. IF EXISTS DROP TABLE tab
7. Is the following statement true or false?
A table must contain at least one column.
A. TRUE
B. FALSE
C. DEPENDS
8. Is the following statement true or false?
A table must contain at least one row.
A. TRUE
B. FALSE
9. Is the following statement true or false?
To create a table, you must first issue a statement to choose a default database in which to store the ta-ble.
A. FALSE
B. TRUE
10. Which clause can you add to a CREATE TABLE statement to ensure that no error occurs if the table
already exists?
A. IF NOT EXISTS
B. IF NOT EXIST
C. IF NOT EXISTS TABLE
D. NONE
11. Why does the following SQL statement fail?
CREATE TABLE cats (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
name CHAR(10)
);
12. There are two ways using SQL statements to create a copy of a table (structure and data). Assume that
you want to create a copy of the world.City table in the test database. How would you accomplish
that, using those two ways?
A. CREATE TABLE test.City SELECT * FROM world.City
B. CREATE TABLE City SELECT * FROM City
C. CREATE TABLE test.City LIKE world.City
D. NONE
13. Is the following statement true or false?
You can add multiple columns to a table with a single ALTER TABLE statement.
A. TRUE
B. FALSE
14. Is the following statement true or false?
You can add one or more rows to a table with a single ALTER TABLE statement.
A. TRUE
B. FALSE
15. Is the following statement true or false?
You can create multiple indexes at a time with a single ALTER TABLE statement.
A. TRUE
B. FALSE
16. Is the following statement true or false?
You can drop all columns of a table (thus dropping the table itself) with a single ALTER TABLE state-ment.
A. TRUE
B. FALSE
17. There are two ways to rename table tbl to tbl_new with SQL statements. What statements can you
use?
A. ALTER TABLE tbl RENAME TO tbl_new;
B. RENAME TABLE tbl TO tbl_new;
C. RENAME TABLE t1 TO tmp, t2 TO t1, tmp TO t2;
18. Name the two most common reasons to create an index on a table
A. Indexes can speed up retrievals, especially for large tables, and they can be used to place restrictions on
columns to ensure that a column or a set of columns may contain only unique-valued entries.
B. Especially for large tables, and they can be used to place restrictions on
columns to ensure that a column or a set of columns may contain only unique-valued entries.
C. NONE
19. Table mytable has a composite PRIMARY KEY consisting of both col1 and col2. Is it possible to
declare one of the two columns as NULL, like this?
CREATE TABLE mytable (
col1 CHAR(5) NOT NULL,
col2 CHAR(5) NULL,
PRIMARY KEY (col1,col2)
);
A. YES
B. NO
20. You have a table mytable that looks like this:
mysql> DESCRIBE mytable;
+-------+---------+
| Field | Type |
+-------+---------+
| col1 | int(11) |
| col3 | int(11) |
+-------+---------+
You want to add three more columns: col0 as the first column in the table, col2 between col1 and
col3, and col4 as the last column. All new columns should be of type INT. What SQL statement do
you issue?
A. ALTER TABLE mytable
-> ADD col0 INT FIRST,
-> ADD col2 INT,
-> ADD col4 INT LAST;
B. ALTER TABLE mytable
-> ADD col0 INT FIRST,
-> ADD col2 INT AFTER col1,
-> ADD col4 INT;
C. NONE
21. You want to see what indexes you have in table tbl, but DESCRIBE tbl does not show sufficient in-formation. What other statement can you issue to obtain additional information about the table structure?
A. SHOW CREATE TABLE tbl
B. SHOW TABLE tbl
C. SELECT CREATE TABLE tbl
22. To declare a primary key on only one column (col1, with data type INT) of table tbl at creation time,
you can use the following syntax:
mysql> CREATE TABLE tbl (col1 INT NOT NULL PRIMARY KEY);
What's the correct syntax if you want to declare a composite primary key for this table on two INT
columns col1 and col2?
A. CREATE TABLE tbl (
-> col1 INT NOT NULL,
-> col2 INT NOT NULL,
-> PRIMARY KEY (col1, col2)
-> );
B. CREATE TABLE tbl (
-> col1 INT NOT NULL,
-> col2 INT NOT NULL,
-> PRIMARY KEY (col1), PRIMARY KEY (col2) );
C. CREATE TABLE tbl (
-> col1 INT NOT NULL PRIMARY ,
-> col2 INT NOT NULL PRIMARY ,
-> KEY (col1, col2)
-> );
23. How can you empty a table? What's the best SQL statement for this?
A. TRUNCATE TABLE City
B. DELETE FROM City
C. DROP FROM City
D. DELETE TABLE City
E. ALL
25. What SHOW statement will retrieve a list of columns in the table test.mytest, where the column
names begin with id?
A. SHOW COLUMS FROM mytest FROM test LIKE 'id%';
B. SHOW COLUMN FROM mytest FROM test LIKE 'id%';
C. NONE
D. SHOW COLUMNS FROM mytest FROM test LIKE 'id%';
E. SHOW COLUMNS FROM mytest FROM test LIKE '_id%';
26. What SHOW statement will retrieve a statement that could be used to recreate the table test.mytest
in an arbitrary database? Assume that test is not the default database
A. SHOW CREATE test.mytest;
B. SELECT CREATE TABLE test.mytest;
C. SHOW CREATE TABLE test.mytest;
27. You know that MyISAM is the built-in default storage engine in MySQL. So, what is the explanation for
the Engine value in the following SHOW TABLE STATUS output? What could you do to make sure
that the table gets created as a MyISAM table?
mysql> CREATE TABLE defaulttype (id INT);
mysql> SHOW TABLE STATUS LIKE 'defaulttype';
+-------------+--------+-| Name | Engine | ...
+-------------+--------+-| defaulttype | InnoDB | ...
+-------------+--------+-
A. SET storage_engine = InnoDB;
B. SET SQL_MODE = InnoDB;
C. SET storage_enginer = InnoDB;
28. How can you change the server's default storage engine for new tables from MyISAM to InnoDB if the
server is already running?
A. SET GLOBAL storage_engine=InnoDB;
B. SET SQL_MODE storage_engine=InnoDB;
C. ALL
Nenhum comentário:
Postar um comentário