Академический Документы
Профессиональный Документы
Культура Документы
Id Ch Na Fla
g
2 A Jack Y
5 B Amy N
1 $ Adams N
3 * Anna Y
7 @ Rose N
4 & Smith Y
6 ! Sue Y
3) What will happen in a scenario where there NO match between two tables
that are queried using a Right outer join? ?(Multiple answer)
The right table will return ALL rows
The right table will return NULL
Both tables will return NULL
The left table will return ALL rows
The left table will return NULL
4) PRODUCT
------------------
Product ID (Primary key)
Product Description
Manufacture ID
MANUFACTURE
-------------------------
Manufacture ID (Primary key)
Manufacture name
Referring to the above table, what type of relationship exists between the
product table and the Manufacture table?
a) Product-many Manufacture-many
b) Product-one or many Manufacture-one or many
c) Product-many Manufacture-one
d) Product-one Manufacture-one
e) Product-one Manufacture-many
Col
1
1
#Table2
Col
1
1
-1
%1
[-]1
[%]
1
6) Which of the following are true about DELETE statements? ?(Multiple answer)
DELETE removes rows one at a time and records an entry in the
transaction log for each deleted row
DELETE cannot be find on a table referenced by a FOREGION KEY
constraint
DELETE activates triggers
DELETE cannot be rolled back
DELETE resets identity of the table
DELETE can be used with or without a WHERE clause
7) Create table #T( i int identity(1,1) not null, c varchar(5) not null)
Select * from #T
What will be the result of the select query?
a) 2, two
b) 2, two
3, three
c) 1, two
2, three
d) 2, three
e) 1, three
9) You are creating a procedure that will update two tables within a transaction.
The code looks similar to the following (line numbers are included for
reference only )
1 BEGIN TRANSACTION
2
3 BEGIN TRY
4 UPDATE..
5
6 END TRY
7
8 BEGIN CATCH
9 IF
10
11 END CATCH
12
In most common situations, where would you put the rollback statement?
a) Line 2
b) Line 5
c) Line 7
d) Line 10
e) Line 12
10) WEAPON
AMMUNITION
COUNTRY
SELECT W.NAME
FROM WEAPON W
INNER JOIN COUNTRY C ON C.C_ID=W.C_ID AND C.ORG=1
INNER JOIN AMMUNITION A ON A.A_ID=W.A_ID
UNION
SELECT W.NAME
FROM WEAPON W
INNER JOIN COUNTRY C ON C.C_ID=W.C_ID AND C.ORG=2
INNER JOIN AMMUNITION A ON A.A_ID=W.A_ID
What happens to the tables doctors and physicians when the sample code
above is executed?
a) All rows from both tables are deleted because of an improper join between
doctors and physicians
b) Nothing happen to either table because an error is caused by the use of a
subquery in the WHERE clause of the DELETE statement
c) Nothing happen to either table because an error is caused by the inclusion
of more than one table in the DELETE table
d) The corresponding rows are deleted from the doctors table because it is
listed first, but the physicians table remains unaffected.
e) The corresponding rows are deleted from both the doctors and
physicians tables
A developer reports the sample query always returns only one row, but takes
about an hour to execute against the database. What is the most likely
explanation for the poor performance?
a) Inventory.item_id is not an indexed column
b) The order by clause must sort millions of records before selecting which
one to run
c) The query should not return table _id column in the return set: the
developer should modify the query to return human related data values
d) The database is over-normalized and must be radically restructured
e) The inner join should be converted to outer joins to speed performance
14) T1
Delete from t1 where cnt < (select MAX (T.cnt) from T1 T where
T1.cno=T.cno);
Based on the scenario above, how many rows remain in table T1 after the
DELETE statement is
a) 2 rows
b) 3 rows
c) 4 rows
d) 5 rows
e) 6 rows
15) Select the BEST scenario(s) for the backup strategy: FULL database
backup+ Transaction log backup
The database has few data modifications
The database is considerably large or predicted to grow large in the
near future.
There are substantial updates/data modifications taken place on the
database
In case of a disaster, the need is to recover the database to as recent a
state as possible thus not to lose any transactions taken place on it.
You cannot afford to lose changes since the most recent database
backup
The database is small. The amount of time required to backup a small
database is reasonable.
What will be the likely query plan for above query? Which index will SQL
SERVER use in above query? Please give an explanation for your answer.
Write a query to return the customer details and the details of the most
recent order placed by the customer.
If this was the only query to be executed at all times, what indexes would you
create on the two tables?
SELECT *
FROM #SORDER JOIN #CUST
ON #SORDER.CID=#CUST.CID
WHERE SDATE=(SELECT MAX(SDATE)
FROM #SORDER)