<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=SQL_Quiz</id>
	<title>SQL Quiz - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=SQL_Quiz"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=SQL_Quiz&amp;action=history"/>
	<updated>2026-05-02T18:52:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=SQL_Quiz&amp;diff=87288&amp;oldid=prev</id>
		<title>Lsokolowski1 at 15:53, 25 January 2023</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=SQL_Quiz&amp;diff=87288&amp;oldid=prev"/>
		<updated>2023-01-25T15:53:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:SQL]]&lt;br /&gt;
&lt;br /&gt;
 IMPORTANT NOTE for trainers only: &lt;br /&gt;
 Please DO NOT change these materials without direct permission from LUKASZ SOKOLOWSKI.&lt;br /&gt;
&lt;br /&gt;
{{Can I use your material}}&lt;br /&gt;
&lt;br /&gt;
== SQL Quiz ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SQL BASICS - QUIZ (for Oracle and MSSQL)&lt;br /&gt;
&lt;br /&gt;
15 questions.&lt;br /&gt;
Only one answer is correct.&lt;br /&gt;
You have 15 min.&lt;br /&gt;
60% to pass.&lt;br /&gt;
The author of this test will be your teacher on the advanced session, &lt;br /&gt;
should you choose to accept the mission (-;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. &amp;quot;SELECT&amp;quot; clause, by itself only&lt;br /&gt;
&lt;br /&gt;
a) filters the rows&lt;br /&gt;
b) chooses the source of data&lt;br /&gt;
c) filters the columns&lt;br /&gt;
d) don&amp;#039;t know&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;ONLY FETCH FIRST 2 ROWS&amp;quot; or &amp;quot;2 TOP&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) removes first 2 rows&lt;br /&gt;
b) gives just 2 first rows from the result&lt;br /&gt;
c) does nothing&lt;br /&gt;
d) dunno&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. &amp;quot;DISTINCT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) makes the result unique, each column separately&lt;br /&gt;
b) gives the non redundant result, per vector of columns&lt;br /&gt;
c) must be always at the end of the query&lt;br /&gt;
d) &amp;#039;ve no watery idea&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. &amp;quot;UNION ALL&amp;quot; vs &amp;quot;UNION&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) there is no single difference between them&lt;br /&gt;
b) the first one doesn&amp;#039;t show the duplicates&lt;br /&gt;
c) both are SQL set operators &lt;br /&gt;
d) How should I know?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. &amp;quot;WHERE column_name &amp;lt;&amp;gt; 200&amp;quot; vs &amp;quot;WHERE column_name != 200&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) they both give EXACTLY the same result&lt;br /&gt;
b) the &amp;#039;!=&amp;#039; is the ISO one&lt;br /&gt;
c) aargh.. why they made three ways to do the same thing, huh?!&lt;br /&gt;
d) Who the hack supposed to know that?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. &amp;quot;SELECT SYSDATE FROM DUAL&amp;quot; or &amp;quot;SELECT GETDATE()&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) will ALWAYS result into this format: &amp;#039;21/06/29&amp;#039;&lt;br /&gt;
b) uses the table, which has real and meaningful data&lt;br /&gt;
c) has a minimum amount of sql clauses to run a query&lt;br /&gt;
d) Am I the only one who doesn&amp;#039;t know, huh?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. &amp;#039;I am a literal string, wrap me ALWAYS into single quotes&amp;#039;&lt;br /&gt;
&lt;br /&gt;
a) The value above says TRUE&lt;br /&gt;
b) The sentence DIRECTLY above is FALSE&lt;br /&gt;
c) We should always wrap literal strings into double citation&lt;br /&gt;
d) Oh, boy - who the bell should know it?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. &amp;quot;ORDER BY 3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) this clause must be always EXACTLY after &amp;quot;FROM&amp;quot; clause&lt;br /&gt;
b) it will sort the final result by the third element in &amp;quot;SELECT&amp;quot; clause, descending&lt;br /&gt;
c) sorts the result of the query&lt;br /&gt;
d) dunno&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
9. How to do the &amp;quot;right outer equi-join&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
a) &amp;quot;FROM t2, t3 WHERE t2.id = t3.no (+)&amp;quot; and &amp;quot;t2 OUTER JOIN t3 ON t2.id = t3.no&amp;quot;&lt;br /&gt;
b) &amp;quot;FROM t2 JOIN t3 ON t2.id = t3.no&amp;quot; and &amp;quot;t2 INNER t3 ON t2.id = t3.no&amp;quot;&lt;br /&gt;
c) &amp;quot;FROM t2, t3 WHERE t2.id (+)= t3.no&amp;quot; and &amp;quot;t2 RIGHT JOIN t3 ON t2.id = t3.no&amp;quot;&lt;br /&gt;
d) nope, nothing rings the bell yet..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10. This expresssssssion &amp;quot;column_name LIKE &amp;#039;_A%&amp;#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) should be used only in &amp;quot;SELECT&amp;quot; clause&lt;br /&gt;
b) can be used in &amp;quot;SELECT&amp;quot; clause&lt;br /&gt;
c) searches for the strings like: KARL, LA, GAMING, CALVIN_KL&lt;br /&gt;
d) (in the Treeish talk): hummmmmmm.. nommmmmmm.. naaaaahh..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11. &amp;quot;SELECT very_ugly_column_name AS &amp;#039;So neaty now!&amp;#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) will result with an error in &amp;#039;Oracle&amp;#039; but works in &amp;#039;MSSQL&amp;#039;&lt;br /&gt;
b) makes an extra column with same value in each row: &amp;quot;So neaty now!&amp;quot;&lt;br /&gt;
c) syntax like that(with an &amp;#039;AS&amp;#039; keyword) no longer works here in &amp;#039;Oracle&amp;#039; and &amp;#039;MSSQL&amp;#039;&lt;br /&gt;
d) Ook. Oooook.. Ook, oook. Ook..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12. &amp;quot;k XOR w&amp;quot; operator&lt;br /&gt;
&lt;br /&gt;
a) does this very logic: (k OR w) AND NOT (k AND w)&lt;br /&gt;
b) we use it EXACTLY the way it&amp;#039;s written here&lt;br /&gt;
c) there is no such operator in &amp;#039;Oracle&amp;#039; and &amp;#039;MSSQL&amp;#039;&lt;br /&gt;
d) does the wicked logic and no one knows the magic here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
13. In the query like the one below:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;SELECT column_name2, column_name3 AS New nice name&lt;br /&gt;
FROM tab4 &lt;br /&gt;
GROUP BY column_name3&lt;br /&gt;
ORDER BY column_name3;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) the result will be properly first sorted and then grouped&lt;br /&gt;
b) the result will be properly first aggregated and then sorted&lt;br /&gt;
c) the result will fail&lt;br /&gt;
d) ..how Lucky me, I still don&amp;#039;t know that..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
14. &amp;quot;WHERE min(column2) &amp;gt;= 550&amp;quot;&lt;br /&gt;
a) such a non conditional statement will give an empty result&lt;br /&gt;
b) it will result with something&lt;br /&gt;
c) this will fail&lt;br /&gt;
d) dunno&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
15. Take a Look at this not working query:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;SELECT&lt;br /&gt;
   max(col1) AS &amp;quot;The biggest ...&amp;quot;&lt;br /&gt;
   , concat(col2, &amp;#039; is a &amp;#039;, col3) AS &amp;quot;Why not to duck this name, huh?&amp;quot;&lt;br /&gt;
FROM t6 JOIN t7 ON t6.id = t7.signedID&lt;br /&gt;
WHERE col4 IN (1, 2, 5) AND col5 &amp;lt; 700&lt;br /&gt;
   OR&lt;br /&gt;
   col6 IN ( SELECT col6, col7 FROM t4 WHERE col8 BETWEEN 24 AND 127 )&lt;br /&gt;
GROUP BY col2, col3&lt;br /&gt;
HAVING avg(col1) &amp;gt; 2000&lt;br /&gt;
ORDER BY 2;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
a) it doesn&amp;#039;t work ONLY because of the missing correlation between the inner and the outer queries&lt;br /&gt;
b) it&amp;#039;s spoiled by the old Gremlin with his humongously huge fart &lt;br /&gt;
c) this will fix it in &amp;#039;Oracle&amp;#039;: &amp;quot;(col6, col9) IN ... &amp;quot;, and it can have a workaround with correlation in &amp;#039;MSSQL&amp;#039;&lt;br /&gt;
d) &amp;quot;I must unlearn what I have learned.&amp;quot;    -|[====]|[-----------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------- THE END -------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lsokolowski1</name></author>
	</entry>
</feed>