Вы находитесь на странице: 1из 15

Sun 310-813

Version

QUESTION NO: 1
Which of the following privileges are required to create a view? ACREATE BCREATE
VIEW CSome privilege (INSERT, SELECT, UPDATE) for each column in SELECT clause
DALTER

Answer:

QUESTION NO: 2
Consider the users table and admins view are given by the following. mysql> SELECT
* FROM users; CREATE VIEW admins AS SELECT id, username, created, admin FROM users
WHERE admin = 'Y' Do the following two queries produce the same result? 1. SELECT
id, username, created, admin FROM admins WHERE created < '2005-07-31 00:00:00' 2.
SELECT id, username, created, admin FROM users WHERE admin = 'Y' AND created <
'2005-07-31 00:00:00' Atrue Bfalse

Answer:

QUESTION NO: 3
What must be done to in order to put a new VIEW definition in place of an already
existing view with the same name? AYou need to restart the server which will delete
the old view, then you create the new view with the old name. BYou can use the
CREATE OR REPLACE VIEW command. CYou have to delete the view first and create a new
one with the same name. DYou can use the CREATE IF NOT EXISTS VIEW command.

Answer:

QUESTION NO: 4
Which of the following statements are true? AA view created with the TEMPTABLE
algorithm is not updatable. BA view containing a GROUP BY clause is not updatable.
CA view containing a WHERE clause is not updatable. DA view containing a HAVING
clause is not updatable.

Answer:

QUESTION NO: 5
Which of the following is a valid command for listing views in a database? ASHOW
VIEWS BSHOW FULL TABLES CSHOW FULL TABLES VIEWS DLIST VIEWS

Answer:

QUESTION NO: 6
Consider the following statement: TER VIEW v_USCity AS SELECT Name FROM City WHERE
CountryCode = 'USA' What would be the result if the above statement was issued and
the view v_USCity did not previously exist? AThe view v_USCity would be created.
BAn error would be issued that the view v_USCity does not exist. CA warning would
be issued that the view v_USCity does not exist, then it would create it. DThe
query would appear to have executed, but no action on that view would occur.

Answer:
QUESTION NO: 7
Which of the following rules should apply to a view for it to be considered
updateable: AThe user must have the UPDATE or DELETE privilege for the underlying
table. BThere must be a subquery in the WHERE clause that refers to a table in the
FROM clause. CThere must be a 1-to-1 relationship between the rows in the view and
the rows in the underlying table. DThe view must only refer to literal values.

Answer:

QUESTION NO: 8
Complete the following sentence. When running mysqldump with the --tab option ...

A. .. all files are written to the specified path on the server machine.
B. .. all files are written to the specified path on the client machine.
C. .. the .sql files are written to the specified path on the server and the .txt
files are written to the client.
D. .. the .txt files are written to the specified path on the server and the .sql
files are written to the client.
Answer: D

QUESTION NO: 9
Consider the following two statements: LOAD DATA INFILE SELECT ... INTO OUTFILE
Which of the following are respective interfaces to the above statements?
Amysqlload Bmysqlimport Cmysqlexport Dmysqldump

Answer:

QUESTION NO: 10
Which of the following command-line utilities and SQL statements will import at
least some, but not necessarily all, of the different types of data exported by the
mysqldump program? AThe mysqlimport command-line utility BThe mysql command-line
utility CThe source command in the mysql command-line utility DThe LOAD DATA INFILE
SQL statement EThe LOAD SQL INFILE SQL statement

Answer:

QUESTION NO: 11
You have an external application that requires an input file with comma-separated
values. How can you produce such a file containing the contents of the
CountryLanguage table using MySQL's SELECT ... INTO OUTFILE facility? ASELECT *
FROM CountryLanguage INTO OUTFILE '/tmp/CountryLanguage.csv' WITH SEPARATOR ','
BSELECT * FROM CountryLanguage INTO OUTFILE '/tmp/CountryLanguage.csv' FIELDS
TERMINATED BY ',' CSELECT * FROM CountryLanguage INTO OUTFILE
'/tmp/CountryLanguage.csv' AS CSV DThere is no support for exporting comma-
separated data.

Answer:

QUESTION NO: 12
In stored procedures, what happens when a cursor reaches the end of the block in
which it is opened? AIt is automatically closed. BIt remains open, and has to be
explicitly closed. CIt causes the block to terminate if not explicitly closed.
Answer:

QUESTION NO: 13
Which of the following is the correct method of retrieving OUT and INOUT values
when a procedure has executed? ASession variables BUser variables CThe SET
statement DThe CALL statement

Answer:

QUESTION NO: 14
Which of the following, when enabled, can prevent a client from defining stored
routines? AThe slow query log BThe binary log CThe general query log DNone of the
above has any effect on defining stored routines

Answer:

QUESTION NO: 15
Consider the following statement to create the stored procedure param_test. CREATE
PROCEDURE param_test ( IN p_in INT, OUT p_out INT, INOUT p_inout INT) BEGIN SELECT
p_in, p_out, p_inout; SET p_in = 100, p_out = 200, p_inout = 300; END; The
following command has set the values of the three variables: mysql> SET @v_in = 0,
@v_out = 0, @v_inout = 0; What will be the output of the following set of commands?
mysql> CALL param_test(@v_in, @v_out, @v_inout); mysql> SELECT @v_in, @v_out,
@v_inout; A(0, 0,0) and (0, 0, 0) B(0, 0, 0) and (0, 200, 300) C(0, NULL, 0) and
(0, 200, 300) D(0, NULL, 0) and (100, 200, 300)

Answer:

QUESTION NO: 16
Consider the following query: SELECT Name FROM Country WHERE Code = 'MEX' What
would be the consequence of this query if executed in a stored procedure? AThe
value would not be available unless stored in a variable. BAn error would be
issued. CThe results would be sent directly to the client. DA warning would be
issued.

Answer:

QUESTION NO: 17
When used in a stored routine, which of the following demonstrates correct usage of
CASE? ACREATE PROCEDURE name_check (IN name CHAR(25)) BEGIN CASE name WHEN 'United
States' THEN SELECT 'USA' AS Code; ELSEIF WHEN 'Finland' THEN SELECT 'FIN' AS Code;
ELSE SELECT 'Other' AS Code; END CASE; END BCREATE PROCEDURE name_check (IN name
CHAR(25)) BEGIN CASE name WHEN 'United States' THEN SELECT 'USA' AS Code; ELSE WHEN
'Finland' THEN SELECT 'FIN' AS Code; ELSE SELECT 'Other' AS Code; END CASE; END
CCREATE PROCEDURE name_check (IN name CHAR(25)) BEGIN CASE name WHEN 'United
States' THEN SELECT 'USA' AS Code; WHEN 'Finland' THEN SELECT 'FIN' AS Code; ELSE
SELECT 'Other' AS Code; END CASE; END DCREATE PROCEDURE name_check (IN name
CHAR(25)) BEGIN CASE name WHEN 'United States' THEN SELECT 'USA' AS Code; WHEN
'Finland' THEN SELECT 'FIN' AS Code; ELSE THEN SELECT 'Other' AS Code; END CASE;
END

Answer:
QUESTION NO: 18
Which of the following is true for SELECT ... INTO statements? AIt must return only
one row. BIt can return single or multiple rows. CIt can only assign one variable
at a time. DIt is only used in stored functions.

Answer:

QUESTION NO: 19
In a stored routine, which of the following examples correctly demonstrates a
variable being assigned a value then used? ASET name_var = 'Atlanta'; SELECT
Population FROM City WHERE Name = name_var; BDECLARE name_var = 'Atlanta'; SELECT
Population FROM City WHERE Name = @name_var; CDECLARE name_var = 'Atlanta'; SELECT
Population FROM City WHERE Name = name_var; DSET name_var = 'Atlanta'; SELECT
Population FROM City WHERE Name = @name_var;

Answer:

QUESTION NO: 20
Where are IN, OUT, and INOUT parameter declarations used? AViews BStored functions
CStored procedures DTriggers

Answer:

QUESTION NO: 21
Which of the following correctly demonstrates how to retrieve stored routine
metadata through INFORMATION_SCHEMA? ASELECT * FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME = 'city_pop' AND ROUTINE_SCHEMA = 'world' BSELECT * FROM
INFORMATION_SCHEMA.STORED_ROUTINES WHERE ROUTINE_NAME = 'city_pop' AND
ROUTINE_SCHEMA = 'world' CSELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE =
'city_pop' AND SCHEMA = 'world' DSELECT * FROM INFORMATION_SCHEMA.STORED_ROUTINES
WHERE ROUTINE = 'city_pop' AND SCHEMA = 'world'

Answer:

QUESTION NO: 22
Which of the following is true for the perror utility program? AThe utility returns
information about any error in the InnoDB table handler. BThe utility returns
information about low-level (OS-specific) MyISAM errors. CThe utility returns info
about "p" type errors. DThere is no such utility program as perror.

Answer:

QUESTION NO: 23
When executing multi-row operations, what should be the first thing you look for to
see if anything unexpected happened? AWarning/Error Count. BWarning/Error Codes.
CWarning/Error messages.

Answer:

QUESTION NO: 24
Which of the following best describes the differences between SHOW WARNINGS and
SHOW ERRORS? ASHOW WARNINGS returns only warnings; SHOW ERRORS returns only errors.
BSHOW WARNINGS returns only warnings; SHOW ERRORS returns both warnings and errors.
CSHOW WARNINGS returns both errors and warnings; SHOW ERRORS returns errors and
notes. DSHOW WARNINGS returns errors, warnings and notes; SHOW ERRORS returns only
errors.

Answer:

QUESTION NO: 25
Consider the following statement: SHOW COUNT(*) WARNINGS What would be the result
of executing this statement? AAn error would be returned, as this is not valid
syntax. BThe number of current warnings would be returned. CThe total number of
warnings server-wide would be returned.

Answer:

QUESTION NO: 26
Assuming the user has just connected to the MySQL server, what will the result of
the following query be? SELECT @a AAn error saying that a is undefined. BA single
NULL. CAn empty string. DIt depends on whether a PERSISTENT user variable named a
has been set by this user previously.

Answer:

QUESTION NO: 27
The CountryLanguage table is given by the following. mysql> DESC CountryLanguage;
The following query will return the number of distinct languages listed in the
CountryLanguage table. SELECT COUNT(DISTINCT Language) FROM CountryLanguage You
wish to store this value in a user variable called @langcount. Which of the
following will achieve this? ASELECT @langcount := COUNT(DISTINCT Language) FROM
CountryLanguage BSELECT @langcount = COUNT(DISTINCT Language) FROM CountryLanguage
CSELECT STORE('langcount', COUNT(DISTINCT Language) ) FROM CountryLanguage DSELECT
SET('langcount', COUNT(DISTINCT Language) ) FROM CountryLanguage

Answer:

QUESTION NO: 28
Which of the following statements is true? A"IN cannot be used with the <, > or =
operators for correlated subqueries." B"IN cannot be used with correlated
subqueries." C"IN can only be used with the = operator for correlated subqueries."
D"IN can only be used with the < and > operators for scalar subqueries."

Answer:

QUESTION NO: 29
Consider the Country table. mysql> DESCRIBE Country; Which of the following queries
correctly utilize a table subquery to compute the average GNP per continent?
ASELECT AVG(SUM(GNP)) FROM country GROUP BY continent BSELECT AVG(GNP) FROM (SELECT
SUM(GNP) FROM Country GROUP BY continent) CSELECT AVG(GNP) FROM (SELECT SUM(GNP)
FROM Country GROUP BY continent) AS co DSELECT AVG(GNP_sum) FROM (SELECT SUM(GNP)
AS GNP_sum FROM Country GROUP BY continent) ESELECT AVG(GNP_sum) FROM (SELECT
SUM(GNP) AS GNP_sum FROM Country GROUP BY continent) AS co

Answer:
QUESTION NO: 30
Consider the structures of the Country and CountryLanguage tables. mysql > DESCRIBE
Country; mysql > DESCRIBE CountryLanguage; Which of the following queries will give
you the list of all European countries where German is spoken? ASELECT Code AS c,
Name FROM Country WHERE Continent = 'Europe' AND EXISTS (SELECT * FROM
CountryLanguage WHERE CountryCode = c AND Language = 'German') BSELECT Code AS c,
Name FROM Country WHERE Continent = 'Europe' AND EXISTS IN (SELECT * FROM
CountryLanguage WHERE CountryCode = c AND Language = 'German') BSELECT Code AS c,
Name FROM Country WHERE Continent = 'Europe' AND EXISTS IN (SELECT * FROM
CountryLanguage WHERE CountryCode = c AND Language = 'German') CSELECT Code AS c,
Name FROM Country WHERE Continent = 'Europe' AND EXISTS (SELECT Language,
CountryCode FROM CountryLanguage WHERE CountryCode = c AND Language = 'German')
CSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND EXISTS (SELECT
Language, CountryCode FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') CSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND
EXISTS (SELECT Language, CountryCode FROM CountryLanguage WHERE CountryCode = c AND
Language = 'German') CSELECT Code AS c, Name FROM Country WHERE Continent =
'Europe' AND EXISTS (SELECT Language, CountryCode FROM CountryLanguage WHERE
CountryCode = c AND Language = 'German') CSELECT Code AS c, Name FROM Country WHERE
Continent = 'Europe' AND EXISTS (SELECT Language, CountryCode FROM CountryLanguage
WHERE CountryCode = c AND Language = 'German') CSELECT Code AS c, Name FROM Country
WHERE Continent = 'Europe' AND EXISTS (SELECT Language, CountryCode FROM
CountryLanguage WHERE CountryCode = c AND Language = 'German') CSELECT Code AS c,
Name FROM Country WHERE Continent = 'Europe' AND EXISTS (SELECT Language,
CountryCode FROM CountryLanguage WHERE CountryCode = c AND Language = 'German')
CSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND EXISTS (SELECT
Language, CountryCode FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') DSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND NOT
EXISTS (SELECT * FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') DSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND NOT
EXISTS (SELECT * FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') DSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND NOT
EXISTS (SELECT * FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') DSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND NOT
EXISTS (SELECT * FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') DSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND NOT
EXISTS (SELECT * FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') DSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND NOT
EXISTS (SELECT * FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') DSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND NOT
EXISTS (SELECT * FROM CountryLanguage WHERE CountryCode = c AND Language =
'German') DSELECT Code AS c, Name FROM Country WHERE Continent = 'Europe' AND NOT
EXISTS (SELECT * FROM CountryLanguage WHERE CountryCode = c AND Language =
'German')

Answer:

QUESTION NO: 31
Which of the following statements is the proper way to use a subquery as a scalar
expression? ASELECT ( SELECT SUM(Population) FROM Country WHERE Code = 'USA' +
SELECT SUM(Population) FROM Country WHERE Code = 'CAN' ) BSELECT SUM(Population)
FROM Country WHERE Code = 'USA' + (SELECT SUM(Population) FROM Country WHERE Code =
'CAN' ) CSELECT (SELECT SUM(Population) FROM Country WHERE Code = 'USA' ) +(SELECT
SUM(Population) FROM Country WHERE Code = 'CAN' ) D(SELECT SUM(Population) FROM
Country WHERE Code = 'USA' + (SELECT SUM(Population) FROM Country WHERE Code =
'CAN' )

Answer:
QUESTION NO: 32
What is the effect of executing the following query? SELECT Continent, Name FROM
Country c1 WHERE Population >= ALL (SELECT Population FROM Country c2 WHERE
c1.Continent=c2.Continent ); AThe query returns every country in each continent.
BThe query returns the continent and the country with the largest population. CThe
query returns the country (or countries) with the largest population on each
continent.

Answer:

QUESTION NO: 33
A query that reports countries without defined capitals in the city table can be
written using a subquery like the following: SELECT Name FROM Country WHERE Capital
NOT IN (SELECT Id from City); With which of the following queries do you get the
same result? ASELECT Country.Name FROM Country RIGHT JOIN City ON (Country.Capital
= City.Id) WHERE Country.Capital IS NULL; BSELECT Country.Name FROM Country, City
WHERE Country.Capital = City.Id AND Country.Capital IS NULL; CSELECT Country.Name
FROM Country LEFT JOIN City ON (Country.Capital = City.Id) WHERE ISNULL(City.Id);
DSELECT Country.Name FROM Country, City WHERE Country.Capital <> City.Id; ESELECT
Country.NameFROM City RIGHT JOIN Country ON (Country.Capital = City.Id) WHERE
City.Id IS NULL;

Answer:

QUESTION NO: 34
What kind of subquery is used in the following SELECT? SELECT DISTINCT Language
FROM CountryLanguage WHERE CountryCode IN (SELECT Code FROM Country WHERE
Continent='Asia') ORDER BY Language AA scalar subquery. BA row subquery. CA column
subquery. DA table subquery.

Answer:

QUESTION NO: 35
Consider the Country table. mysql> DESCRIBE COUNTRY; Which of the following queries
will produce a list of all continents along with their largest country? ASELECT
continent, name, surfacearea FROM Country AS co2 WHERE co2.surfacearea = (SELECT
MAX(surfacearea) FROM Country AS co1 WHERE co2.continent=co1.continent GROUP BY
co1.continent) BSELECT continent, name, surfacearea FROM Country AS co2 WHERE
co2.surfacearea = (SELECT MAX(surfacearea) FROM Country AS co1 GROUP BY
co1.continent) CSELECT continent, name, surfacearea FROM Country AS co2 WHERE
co2.surfacearea > (SELECT surfacearea FROM Country AS co1 WHERE
co2.continent=co1.continent GROUP BY co1.continent) DSELECT continent, name,
surfacearea FROM Country AS co2 WHERE co2.surfacearea > (SELECT surfacearea FROM
Country AS co1 GROUP BY co1.continent) ESELECT continent, name, surfacearea FROM
Country WHERE surfacearea = (SELECT MAX(surfacearea) FROM Country GROUP BY
continent)

Answer:

QUESTION NO: 36
For maximum efficiency in JOIN operations of one column from each of two tables,
which of the following statements regarding indexes are true? AIn a LEFT JOIN such
as table1 LEFT JOIN table2 ON table1.a = table2.b, the column b in table2 should
always be indexed BA LEFT JOIN would not benefit from either of the participating
columns being indexed CIn an INNER JOIN, either, but not both, columns
participating in the join should be indexed DIn an INNER JOIN, both columns
participating in the join should be indexed EAn INNER JOIN would not benefit from
either of the participating columns being indexed FIn a LEFT JOIN such as table1
LEFT JOIN table2 ON table1.a = table2.b, the column a in table1 should always be
indexed

Answer:

QUESTION NO: 37
Which of the following are valid optimization techniques? ARewrite queries to use
indexes BUse EXPLAIN CUse ORDER BY

Answer:

QUESTION NO: 38
Which of the following statements are true regarding indexes? AThey are always
sorted. BThey are sometimes sorted. CThey improve search times. DThey lengthen
search times.

Answer:

QUESTION NO: 39
Consider the following queries. A SELECT * FROM data B SELECT col1,col2 FROM data C
SELECT * FROM data WHERE col>value D SELECT * FROM data LIMIT 10 No columns are
indexed, unless specifically noted. Which of the following statements are true?
AQuery B will perform faster than Query A as it only has to return some columns.
BQueries A and B will perform at about the same speed because a full table scan
must be performed for both tables. CAssuming that col is an indexed column, query C
will usually perform faster than Query A as it only has to fetch and return some
rows. DAssuming that col is an indexed column, Query C will perform slower than
Query A because it has to analyze all rows for the WHERE condition. EQuery D will
perform faster than Query A as it only has to return some rows. FQueries A and D
will perform at about the same speed because all rows are returned and the client
limits the rows.

Answer:

QUESTION NO: 40
Which of the following are true for a table with one indexed column? ASELECT
operations with a WHERE criteria that includes the indexed column may be able to
reduce the amount of data to be read from disk BSELECT operations with a WHERE
criteria that includes the indexed column will often need to read more data from
disk than if the column was not part of the search criteria CUPDATE operations with
a WHERE criteria that includes the indexed column may be able to reduce the amount
of data to be read from disk before performing the actual update DUPDATE operations
with a WHERE criteria that includes the indexed column will often need to read more
data from disk than if the column was not part of the search criteria EINSERT
operations on the table will be faster than if no columns were indexed FINSERT
operations on the table will be slower than if no columns were indexed GAn index
would have no influence on the speed of INSERT operations

Answer:
QUESTION NO: 41
Which of the following is true for un-optimized queries? AThey can create lock
contention BThey can prevent excessive locks CNone of the above

Answer:

QUESTION NO: 42
The table City has the following index defined. name_code(Name(10),CountryCode(3))
Would the following query use this index? Why? SELECT * FROM City WHERE CountryCode
= 'CAN' ANo. The column specified in the WHERE clause is not a leftmost prefix
column. BYes. The column column specified in the WHERE clause is part of the index.
CNo. Only one part of the index is being queried.

Answer:

QUESTION NO: 43
Which of the following best describes how a column prefix index works and why its
an advantage? AA Column prefix allows for a shorter index, making it read less from
disk. BA Column prefix allows for a shorter index name, making less code to be
written. CA Column prefix is another name for a left-most prefix, which is usefuly
with multi-column indexes.

Answer:

QUESTION NO: 44
Consider the Country and City tables. mysql> DESCRIBE City; mysql> DESCRIBE
Country; The field Country in the City refers to the field Code in the Country
table. Which of the following queries will produce a list of all European countries
ordered by their total population? ASELECT Country.name, City.population FROM City,
Country WHERE City.country=Country.code AND Country.Continent='Europe' ORDER BY
SUM(City.population) DESC BSELECT Country.name, SUM(City.population) FROM City,
Country WHERE City.country=Country.code AND Country.Continent='Europe' ORDER BY
SUM(City.population) DESC CSELECT Country.name, City.population FROM City, Country
WHERE City.country=Country.code AND Country.Continent='Europe' GROUP BY Country
ORDER BY SUM(City.population) DESC CSELECT Country.name, City.population FROM City,
Country WHERE City.country=Country.code AND Country.Continent='Europe' GROUP BY
Country ORDER BY SUM(City.population) DESC CSELECT Country.name, City.population
FROM City, Country WHERE City.country=Country.code AND Country.Continent='Europe'
GROUP BY Country ORDER BY SUM(City.population) DESC CSELECT Country.name,
City.population FROM City, Country WHERE City.country=Country.code AND
Country.Continent='Europe' GROUP BY Country ORDER BY SUM(City.population) DESC
CSELECT Country.name, City.population FROM City, Country WHERE
City.country=Country.code AND Country.Continent='Europe' GROUP BY Country ORDER BY
SUM(City.population) DESC CSELECT Country.name, City.population FROM City, Country
WHERE City.country=Country.code AND Country.Continent='Europe' GROUP BY Country
ORDER BY SUM(City.population) DESC CSELECT Country.name, City.population FROM City,
Country WHERE City.country=Country.code AND Country.Continent='Europe' GROUP BY
Country ORDER BY SUM(City.population) DESC CSELECT Country.name, City.population
FROM City, Country WHERE City.country=Country.code AND Country.Continent='Europe'
GROUP BY Country ORDER BY SUM(City.population) DESC DSELECT Country.name,
SUM(City.population) FROM City, Country WHERE City.country=Country.code AND
Country.Continent='Europe' GROUP BY Country ORDER BY SUM(City.population) DESC
DSELECT Country.name, SUM(City.population) FROM City, Country WHERE
City.country=Country.code AND Country.Continent='Europe' GROUP BY Country ORDER BY
SUM(City.population) DESC DSELECT Country.name, SUM(City.population) FROM City,
Country WHERE City.country=Country.code AND Country.Continent='Europe' GROUP BY
Country ORDER BY SUM(City.population) DESC DSELECT Country.name,
SUM(City.population) FROM City, Country WHERE City.country=Country.code AND
Country.Continent='Europe' GROUP BY Country ORDER BY SUM(City.population) DESC
DSELECT Country.name, SUM(City.population) FROM City, Country WHERE
City.country=Country.code AND Country.Continent='Europe' GROUP BY Country ORDER BY
SUM(City.population) DESC DSELECT Country.name, SUM(City.population) FROM City,
Country WHERE City.country=Country.code AND Country.Continent='Europe' GROUP BY
Country ORDER BY SUM(City.population) DESC DSELECT Country.name,
SUM(City.population) FROM City, Country WHERE City.country=Country.code AND
Country.Continent='Europe' GROUP BY Country ORDER BY SUM(City.population) DESC
ENone of the above; you cannot use aggregate functions in joins.ENone of the above;
you cannot use aggregate functions in joins.

Answer:

QUESTION NO: 45
Consider the City and Country tables are given by the following DESCRIBE output
extracts. mysql> DESC Country; mysql> DESC City; Note: The CountryCode field in the
City table references the Code field in the Country table. Which of the following
DELETE statements will delete the country "Spain" along with all of it's cities?
ADELETE Country, City FROM Country, City WHERE Country.Code=City.CountryCode AND
Country.Name='Spain' BDELETE FROM Country JOIN City ON
Country.Code=City.CountryCode WHERE Country.Name = 'Spain' CDELETE Country, City
USING Country.Code=City.CountryCode WHERE Country.Name='Spain' CDELETE Country,
City USING Country.Code=City.CountryCode WHERE Country.Name='Spain' CDELETE
Country, City USING Country.Code=City.CountryCode WHERE Country.Name='Spain'
DDELETE FROM Country, City WHERE Country.Code=City.CountryCode AND
Country.Name='Spain' DDELETE FROM Country, City WHERE Country.Code=City.CountryCode
AND Country.Name='Spain' DDELETE FROM Country, City WHERE
Country.Code=City.CountryCode AND Country.Name='Spain' DDELETE FROM Country, City
WHERE Country.Code=City.CountryCode AND Country.Name='Spain' DDELETE FROM Country,
City WHERE Country.Code=City.CountryCode AND Country.Name='Spain'

Answer:

QUESTION NO: 46
Given one inner join query and one outer join query that both produce the same
results, which of the following statements is true? AInner joins are usually
faster, use less memory and should be used instead of outer joins. BOuter joins are
usually faster, use less memory and should be used instead of inner joins. CInner
and outer joins are running at the same speed and take the same amount of memory.

Answer:

QUESTION NO: 47
Consider the City and Country tables which are given by the following DESCRIBE
output extracts. mysql> DESC Country; mysql> DESC City; Note: The CountryCode field
in the City table references the Code field in the Country table. Which of the
following DELETE statements will delete all of the cities in the country "Spain"
from the City table? ADELETE City FROM Country JOIN City ON
Country.Code=City.CountryCode WHERE Country.Name = 'Spain' BDELETE FROM City USING
Country, City WHERE Country.Code=City.CountryCode AND Country.Name='Spain' BDELETE
FROM City USING Country, City WHERE Country.Code=City.CountryCode AND
Country.Name='Spain' CDELETE FROM City USING Country JOIN City ON
Country.Code=City.CountryCode WHERE Country.Name='Spain' CDELETE FROM City USING
Country JOIN City ON Country.Code=City.CountryCode WHERE Country.Name='Spain'
CDELETE FROM City USING Country JOIN City ON Country.Code=City.CountryCode WHERE
Country.Name='Spain' CDELETE FROM City USING Country JOIN City ON
Country.Code=City.CountryCode WHERE Country.Name='Spain' CDELETE FROM City USING
Country JOIN City ON Country.Code=City.CountryCode WHERE Country.Name='Spain'
CDELETE FROM City USING Country JOIN City ON Country.Code=City.CountryCode WHERE
Country.Name='Spain' DDELETE FROM City USING Country WHERE
Country.Code=City.CountryCode AND Country.Name='Spain' DDELETE FROM City USING
Country WHERE Country.Code=City.CountryCode AND Country.Name='Spain' DDELETE FROM
City USING Country WHERE Country.Code=City.CountryCode AND Country.Name='Spain'
DDELETE FROM City USING Country WHERE Country.Code=City.CountryCode AND
Country.Name='Spain' DDELETE FROM City USING Country WHERE
Country.Code=City.CountryCode AND Country.Name='Spain'

Answer:

QUESTION NO: 48
Consider the contents of the colors1 and colors2 tables. mysql> SELECT * FROM
colors1; SELECT * FROM colors2; How many rows will be returned by the following
query? SELECT * FROM colors1, colors2 WHERE colors2.name='blue' A0 B1 C2 D4 E8 F16
GThe query will produce a syntax error because it contains no join condition.GThe
query will produce a syntax error because it contains no join condition.

Answer:

QUESTION NO: 49
Which of the following statements are true? ARows are always returned from all
inner joined tables that match the join condition(s). BRows are always returned
from all outer joined tables that match the join condition(s). CRows may be
returned from an inner joined table even if the other table doesn't match the join
condition(s). DRows may be returned from an outer joined table even if the other
table doesn't match the join condition(s).

Answer:

QUESTION NO: 50
Consider the numbers of rows for the City and Country tables. mysql> SELECT
COUNT(*) FROM City; How many rows will the following query produce? SELECT * FROM
City, Country A0 B1 C239 D4079 E4318 (the sum of 239 and 4079) F974881 (the product
of 239 and 4079) GNone of the above; the query will produce a syntax error.

Answer:

QUESTION NO: 51
Consider the numbers of row in the Country and City tables: mysql> SELECT COUNT(*)
FROM Country; Which of the following queries is most efficient for listing the
names and capitals of each country? ASELECT Country.name, City.name FROM Country,
City WHERE Country.Capital=City.id BSELECT Country.name, City.name FROM City,
Country WHERE Country.Capital=City.id CThe queries are equally efficient.

Answer:

QUESTION NO: 52
Consider the personnel table that stores information about you and your coworkers.
mysql> DESCRIBE personnel; The id column holds the unique identifier of each
employee and the boss column references the boss of each employee. Which query will
list all employees' names along with the name of their bosses? ASELECT * FROM
personnel, personnel WHERE personnel.id=personnel.boss BSELECT p1.name, p2.name
FROM personnel AS p1 SELF JOIN personnel AS p2 ON p1.id=p2.boss CSELECT name, name
FROM personnel LEFT JOIN personnel ON id=boss DSELECT p1.name, p2.name FROM
personnel AS p1 LEFT JOIN personnel AS p2 ON p1.id=p2.boss EYou cannot produce this
list with only one query.

Answer:

QUESTION NO: 53
Consider the contents of the class and student tables. mysql> SELECT * FROM class;
mysql> SELECT * FROM student; All but one of the following queries produce the same
results. Which one produces a different result or produces an error? ASELECT * FROM
class JOIN student ON class.class_id=student.class_id BSELECT * FROM class INNER
JOIN student ON class.class_id=student.class_id CSELECT * FROM class LEFT JOIN
student ON class.class_id=student.class_id DSELECT * FROM class JOIN student ON
class.class_id=student.class_id WHERE NOT ISNULL(student.class_id) ESELECT * FROM
class INNER JOIN student ON class.class_id=student.class_id WHERE NOT
ISNULL(student.class_id) ESELECT * FROM class INNER JOIN student ON
class.class_id=student.class_id WHERE NOT ISNULL(student.class_id) ESELECT * FROM
class INNER JOIN student ON class.class_id=student.class_id WHERE NOT
ISNULL(student.class_id) ESELECT * FROM class INNER JOIN student ON
class.class_id=student.class_id WHERE NOT ISNULL(student.class_id) ESELECT * FROM
class INNER JOIN student ON class.class_id=student.class_id WHERE NOT
ISNULL(student.class_id) FSELECT * FROM class LEFT JOIN student ON
class.class_id=student.class_id WHERE NOT ISNULL(student.class_id) FSELECT * FROM
class LEFT JOIN student ON class.class_id=student.class_id WHERE NOT
ISNULL(student.class_id) FSELECT * FROM class LEFT JOIN student ON
class.class_id=student.class_id WHERE NOT ISNULL(student.class_id) FSELECT * FROM
class LEFT JOIN student ON class.class_id=student.class_id WHERE NOT
ISNULL(student.class_id)

Answer:

QUESTION NO: 54
Which of the following methods can be used to find out which character sets are in
use across the server? ASHOW CHARACTER SETS BUse the INFORMATION_SCHEMA.COLUMNS
table CThis can not be done

Answer:

QUESTION NO: 55
Which of the following will allow you to see collation information as well as the
privileges the current user has to each column in the Country table? ASHOW ALL FROM
Country BSHOW COLUMNS FROM Country CSHOW FULL COLUMNS FROM Country DSHOW FULL INFO
FROM Country

Answer:

QUESTION NO: 56
Will the following SELECT query list all of the tables in the INFORMATION_SCHEMA
database? If not, why? SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE
TABLE_SCHEMA = 'INFORMATION_SCHEMA' ORDER BY TABLE_NAME AYes. BNo; the
INFORMATION_SCHEMA database does not contain information on itself. CNo; the WHERE
clause is incorrect. The correct field name is TABLE_SCHEMATA. DNo; there is no
table in the INFORMATION_SCHEMA database called TABLES.

Answer:

QUESTION NO: 57
Will the following two queries produce the same result? If not, why? SELECT
TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'mysql' SELECT
table_name FROM information_schema.tables WHERE table_schema = 'mysql' AYes. BNo;
all references to the INFORMATION_SCHEMA database, including the table and column
names must be uppercase. CNo; the database name, INFORMATION_SCHEMA, is case
insensitive, but table and column name references must be uppercase. DNo; the
database and table names are case insensitive, but column name references must be
uppercase.

Answer:

QUESTION NO: 58
Which of the following correctly demonstrates using mysqlshow to list databases on
a server? Amysqlshow Bmysqlshow database Cmysqlshow databases Dmysqlshow list
databases

Answer:

QUESTION NO: 59
Which of the following MySQL features can be used when querying the
INFORMATION_SCHEMA database? Select all that apply. AUnions. BSubqueries. COuter
joins. DInner joins. ENone of the above.

Answer:

QUESTION NO: 60
Is the following statement true or false? "The INFORMTAION_SCHEMA database can be
used to obtain a list of all tables on the server with no PRIMARY KEY defined."
Atrue Bfalse

Answer:

QUESTION NO: 61
Which of the following statements can be used to undefine a prepared statement
named mystatement ADEALLOCATE mystatement BDROP PREPARE mystatement CDEALLOCATE
PREPARE mystatement DUNDEFINE mystatement

Answer:

QUESTION NO: 62
Which of the following statements best describe why prepared statements are useful:
AThey often reduce the amount of code you have to write. BThey often improve
transaction support. CThey often improve performance when using with stored
procedures. DThey often reduce parsing time when performing several similar queries

Answer:
QUESTION NO: 63
The City table has the following structure: Consider the following statement:
PREPARE CountryByID FROM 'SELECT Country FROM City WHERE ID=?' An error will be
issued when the above statement is executed because there is no Country City table,
and the prepared statement will not be successfully defined. What will occur if a
prepared statement named CountryByID already exists and the above statement is
executed? AAn error will be issued because a prepared statement with the same name
already exists. BAn error will be issued because the new prepared statement
contains an error, and the old prepared statement definition will remain in effect.
CAn error will be issued because the new prepared statement contains an error, and
no prepared statement named CountryByID will exist.

Answer:

QUESTION NO: 64
Which of the following statement types can be prepared? ALOAD DATA INFILE BCALL
CCREATE TABLE DCREATE VIEW

Answer:

QUESTION NO: 65
Which of the following statements can be used to drop a trigger named trigger1 on
table table1 in the test database? Assume that test is the default database. ADROP
TRIGGER trigger1 BDROP TRIGGER table1.trigger1 CDROP TRIGGER test.trigger1 DDROP
TRIGGER trigger1 ON table1

Answer:

QUESTION NO: 66
You wish to create a trigger on the Country table that will populate the session
variables old_countryName and old_countryCode with the Name and Code fields of the
row that is deleted. Will the following CREATE TRIGGER statement achieve this? If
not, why? Note: You may assume that only one row is ever deleted at a time. CREATE
TRIGGER Country_ad AFTER DELETE ON Country FOR EACH ROW BEGIN SET @old_countryName
= NEW.Name; SET @old_countryCode = NEW.Code; END; AYes. BNo; the NEW keyword cannot
be used in a DELETE trigger. CNo; FOR EACH ROW is invalid syntax and should not be
there. DNo; the syntax order is wrong and should read CREATE TRIGGER Country_ad ON
Country AFTER DELETE ... instead.

Answer:

QUESTION NO: 67
With triggers, which of the following is true in regards to their association with
databases and tables? ATriggers belong to tables which are associated with
databases. BTriggers belong to databases and are associated with tables. CTriggers
belong to both databases and tables.

Answer:

QUESTION NO: 68
Which of the following events can be associated with triggers? AINSERT BSELECT
CDELETE DUPDATE EAll of the above
Answer:

QUESTION NO: 69
Assume that there is a trigger named trigger1 on table table1 in the test database.
What is the result of executing the following statement? DROP TABLE test.table1 AIt
will generate an error because you can not drop a table with dependant views in
existance. Btable1 and trigger1 are destroyed. Ctable1 is destroyed, but trigger1
remains defined. DAn error is issued, and table1 cannot be dropped until all
associated triggers are first destroyed.

Answer:

Вам также может понравиться