sql Flashcards

1
Q

Standard numerical operators

A

=, !=, < <=, >, >=

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

Number is [not] within range of two values (inclusive)

A

… WHERE col_name [NOT] BETWEEN … AND …;

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

Number exists in a list

A

… WHERE col_name IN (2, 4, 6);

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

Number does not exist in a list

A

… WHERE col_name NOT IN (1, 3, 5);

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

Case sensitive exact string [inequality] comparison

A

… WHERE col_name [!]= “abc”;

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

Case insensitive exact string [inequality] comparison

A

… WHERE col_name [NOT] LIKE “abc”;

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

Match a single character

A

… WHERE col_name [NOT] LIKE “_bc”;

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

String [does not] exists in a list

A

… WHERE col_name [NOT] IN (“A”, “B”, “C”);

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

Match a sequence of zero or more characters

A

… WHERE col_name [NOT] LIKE “%abc”;

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

Database normalization is useful because

A

minimizes duplicate data in any single table, and allows for data in the database to grow independently of each other

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

Database normalization is useful because

A

minimizes duplicate data in any single table, and allows for data in the database to grow independently of each other

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

Database normalization trade-off

A

Queries get slightly more complex since they have to be able to find data from different parts of the database, and performance issues can arise when working with many large tables.

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

inner join - only contains data that belongs in both of the tables

A

SELECT title, domestic_sales, international_sales
FROM movies
INNER JOIN boxoffice ON movies.id=boxoffice.movie_id;

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

Stored procedure

A

Create once, store and call for several times whenever it is required, it can be executed only in the database and utilizes more memory in the database server.

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

A view

A

A virtual table, Restricting access to data, Making complex queries simple.

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

Alias

A

A name given to table or column.

17
Q

‘HAVING’ CLAUSE and a ‘WHERE’ CLAUSE

A

Having Clause is only used with the GROUP BY function in a query whereas WHERE Clause is applied to each row before they are a part of the GROUP BY function in a query.

18
Q

MERGE statement

A

UPDATE if a row exists, or an INSERT if the row does not exist.

19
Q

What is the need for group functions in SQL?

A

Group functions work on the set of rows and returns one result per group. AVG, COUNT, MAX, MIN, SUM

20
Q

“Trigger” in SQL

A

Stored procedures that are defined to execute automatically in place or after data modifications.

21
Q

ACID

A

Atomic: all or nothing,
Consistency: (?)
Isolation: concurrency controll
Durability: after commit you have it

22
Q

Normalization

A

Organizing data to avoid duplication and redundancy:

1NF, 2, 3

23
Q

DROP and TRUNCATE

A

no rollback, deletes a tables rollback, deletes all rows

24
Q

Index

A

Performance tuning method of allowing faster retrieval of records from the table.