Skip to content

Instantly share code, notes, and snippets.

@LitKnd LitKnd/SELECT-Trivia-Quiz.sql Secret
Created Jun 23, 2017

Embed
What would you like to do?
/*****************************************************************************
Copyright (c) 2017 SQL Workbooks LLC
Terms of Use: https://sqlworkbooks.com/terms-of-service/
Contact: help@sqlworkbooks.com
This is only suitable for test environments.
******************************************************************************/
/* Question 1 */
SELECT 1 WHERE 1=0;
/* Question 2 */
SELECT 1 A ;
/* Question 3 */
SELECT *
FROM (VALUES (1), (2), (3)) AS val(num);
/* Question 4 */
SELECT *
FROM (VALUES (1), (2), (3)) AS val(num)
WHERE EXISTS
(SELECT 1/0);
/* Question 5 */
SELECT
val.num + 100 as new_total
FROM (VALUES (1), (2), (3)) AS val(num)
WHERE new_total = 101;
/* Question 6 */
SELECT
new_total.num
FROM (VALUES (1), (2), (3)) AS val(num)
CROSS APPLY (SELECT val.num + 100) as new_total(num)
WHERE new_total.num = 101;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.