Retrieving Data Flashcards

1
Q

SQL Statement and Case

A

– SQL statements are not case-sensitive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Use of White Space

A

– All extra white space within a SQL statement is ignored when that statement is processed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How Retrieve Top 5 rows in different DBMS (MS SQL Server, DB2, Oracle, MySQL, MariaDB, PostgreSQL, SQLite)

A
  • MS SQL Server – SELECT TOP 5 prod_name FROM Products;
  • DB2 – SELECT prod_name FROM Products FETCH FIRST 5 ROWS ONLY;
  • ORACLE – SELECT prod_name FROM Products WHERE ROWNUM ≤5;
  • MySQL, MariaDB, PostgreSQL, SQLite - SELECT prod_name FROM Products LIMIT 5; - to get 5 next rows - SELECT prod_name FROM Products LIMIT 5 OFFSET 5;
    LIMIT 4 OFFSET 3 = LIMIT3,4 → Yes, they are reversed, so be careful
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Entire Line Comment

A

#

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Multiline Comment

A

/* smth */

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

SELECT уник

A

SELECT DISTINCT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly