diff --git a/sql-queries-2/sql-retrieve-random/sql-random-mssql.sql b/sql-queries-2/sql-retrieve-random/sql-random-mssql.sql new file mode 100644 index 00000000..2879278b --- /dev/null +++ b/sql-queries-2/sql-retrieve-random/sql-random-mssql.sql @@ -0,0 +1,3 @@ +SELECT TOP 1 * + FROM Faculty + ORDER BY NEWID(); diff --git a/sql-queries-2/sql-retrieve-random/sql-random-mysql.sql b/sql-queries-2/sql-retrieve-random/sql-random-mysql.sql new file mode 100644 index 00000000..5183fa62 --- /dev/null +++ b/sql-queries-2/sql-retrieve-random/sql-random-mysql.sql @@ -0,0 +1,4 @@ +SELECT * + FROM Faculty + ORDER BY RAND() + LIMIT 1; diff --git a/sql-queries-2/sql-retrieve-random/sql-random-postgres.sql b/sql-queries-2/sql-retrieve-random/sql-random-postgres.sql new file mode 100644 index 00000000..5a932541 --- /dev/null +++ b/sql-queries-2/sql-retrieve-random/sql-random-postgres.sql @@ -0,0 +1,14 @@ +SELECT * + FROM Faculty + ORDER BY RANDOM() + LIMIT 1; + +SELECT * + FROM Faculty + ORDER BY RANDOM() + LIMIT 2; + +SELECT * + FROM Faculty + ORDER BY RANDOM() + LIMIT 3; diff --git a/sql-queries-7/escape-single-quote/escape-quote-mssql.sql b/sql-queries-7/escape-single-quote/escape-quote-mssql.sql new file mode 100644 index 00000000..e2a4fc64 --- /dev/null +++ b/sql-queries-7/escape-single-quote/escape-quote-mssql.sql @@ -0,0 +1,4 @@ +INSERT INTO + Student (id, name, national_id, birth_date, enrollment_date, graduation_date, gpa) + VALUES + (1001, 'John O' || CHR(39) ||'Liu', 123345566, '2001-04-05', '2020-01-15', '2024-06-15', 4); diff --git a/sql-queries-7/escape-single-quote/escape-quote-pssql.sql b/sql-queries-7/escape-single-quote/escape-quote-pssql.sql new file mode 100644 index 00000000..01aefafd --- /dev/null +++ b/sql-queries-7/escape-single-quote/escape-quote-pssql.sql @@ -0,0 +1,19 @@ +INSERT INTO + Student (id, name, national_id, birth_date, enrollment_date, graduation_date, gpa) + VALUES + (1001, 'John O'Liu', 123345566, '2001-04-05', '2020-01-15', '2024-06-15', 4); + +INSERT INTO + Student (id, name, national_id, birth_date, enrollment_date, graduation_date, gpa) + VALUES + (1001, 'John O''Liu', 123345566, '2001-04-05', '2020-01-15', '2024-06-15', 4); + +INSERT INTO + Student (id, name, national_id, birth_date, enrollment_date, graduation_date, gpa) + VALUES + (1001, $$John O'Liu$$, 123345566, '2001-04-05', '2020-01-15', '2024-06-15', 4); + +INSERT INTO + Student (id, name, national_id, birth_date, enrollment_date, graduation_date, gpa) + VALUES + (1001, 'John O' || CHR(39) ||'Liu', 123345566, '2001-04-05', '2020-01-15', '2024-06-15', 4); diff --git a/sql-queries-7/escape-single-quote/escape-single-quote-mysql.sql b/sql-queries-7/escape-single-quote/escape-single-quote-mysql.sql new file mode 100644 index 00000000..a763aa69 --- /dev/null +++ b/sql-queries-7/escape-single-quote/escape-single-quote-mysql.sql @@ -0,0 +1,4 @@ +INSERT INTO + Student (id, name, national_id, birth_date, enrollment_date, graduation_date, gpa) + VALUES + (1001, CONCAT('John O', CHAR(39), 'Liu'), 123345566, '2001-04-05', '2020-01-15', '2024-06-15', 4);