SQL - Syntax pt.2 Flashcards

1
Q

Various Syntax in SQL

SELECT column1, column2….columnN
FROM table_name;

A

SQL SELECT Statement

SELECT column1, column2….columnN FROM table_name;

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

Various Syntax in SQL

SELECT DISTINCT column1, column2….columnN
FROM table_name;

A

SQL DISTINCT Clause

SELECT DISTINCT column1, column2….columnN
FROM table_name;

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

Various Syntax in SQL

SELECT column1, column2….columnN
FROM table_name
WHERE CONDITION;

A

SQL WHERE Clause

SELECT column1, column2….columnN
FROM table_name
WHERE CONDITION;

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

Various Syntax in SQL

SELECT column1, column2….columnN
FROM table_name
WHERE CONDITION-1 {AND|OR} CONDITION-2;

A

SQL AND/OR Clause

WHERE CONDITION-1 {AND|OR} CONDITION-2;

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

Various Syntax in SQL

SELECT column1, column2….columnN
FROM table_name
WHERE column_name IN (val-1, val-2,…val-N);

A

SQL IN Clause

WHERE column_name IN (val-1, val-2,…val-N);

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

Various Syntax in SQL

SELECT column1, column2….columnN
FROM table_name
WHERE column_name BETWEEN val-1 AND val-2;

A

SQL BETWEEN Clause

WHERE column_name BETWEEN val-1 AND val-2;

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

Various Syntax in SQL

SELECT column1, column2….columnN
FROM table_name
WHERE column_name LIKE { PATTERN };

A

SQL LIKE Clause

WHERE column_name LIKE { PATTERN };

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

Various Syntax in SQL

SELECT column1, column2….columnN
FROM table_name
WHERE CONDITION
ORDER BY column_name {ASC|DESC};

A

SQL ORDER BY Clause

ORDER BY column_name {ASC|DESC};

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

Various Syntax in SQL

SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name;

A

SQL GROUP BY Clause

GROUP BY column_name;

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

Various Syntax in SQL

SELECT COUNT(column_name)
FROM table_name
WHERE CONDITION;

A

SQL COUNT Clause

SELECT COUNT(column_name)
FROM table_name
WHERE CONDITION;

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

Various Syntax in SQL

SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name
HAVING (arithematic function condition);

A

SQL HAVING Clause

HAVING (arithematic function condition);

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

Various Syntax in SQL

CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
…..
columnN datatype,
PRIMARY KEY( one or more columns )
);

A

SQL CREATE TABLE Statement

CREATE TABLE table_name(
column1 datatype,

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

Various Syntax in SQL

DROP TABLE table_name;

A

SQL DROP TABLE Statement

DROP TABLE table_name;

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

Various Syntax in SQL

CREATE UNIQUE INDEX index_name
ON table_name ( column1, column2,…columnN);

A

SQL CREATE INDEX Statement

CREATE UNIQUE INDEX index_name
ON table_name ( column1, column2,…)

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

Various Syntax in SQL

ALTER TABLE table_name
DROP INDEX index_name;

A

SQL DROP INDEX Statement

ALTER TABLE table_name
DROP INDEX index_name;

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

Various Syntax in SQL

DESC table_name;

A

SQL DESC Statement

DESC table_name;

17
Q

Various Syntax in SQL

TRUNCATE TABLE table_name;

A

SQL TRUNCATE TABLE Statement

TRUNCATE TABLE table_name;

18
Q

Various Syntax in SQL

ALTER TABLE table_name {ADD|DROP|MODIFY} column_name {data_ype};

A

SQL ALTER TABLE Statement

ALTER TABLE table_name {ADD|DROP|MODIFY} column_name {data_ype};

19
Q

Various Syntax in SQL

ALTER TABLE table_name RENAME TO new_table_name;

A

SQL ALTER TABLE Statement (Rename)

ALTER TABLE table_name RENAME TO new_table_name;

20
Q

Various Syntax in SQL

INSERT INTO table_name( column1, column2….columnN)
VALUES ( value1, value2….valueN);

A

SQL INSERT INTO Statement

INSERT INTO table_name()
VALUES ();

21
Q

Various Syntax in SQL

UPDATE table_name
SET column1 = value1, column2 = value2….columnN=valueN
[ WHERE CONDITION ];

A

SQL UPDATE Statement

UPDATE table_name
SET column1 = value1
[ WHERE CONDITION ];

22
Q

Various Syntax in SQL

DELETE FROM table_name
WHERE {CONDITION};

A

SQL DELETE Statement

DELETE FROM table_name
WHERE {CONDITION};

23
Q

Various Syntax in SQL

CREATE DATABASE database_name;

A

SQL CREATE DATABASE Statement

CREATE DATABASE database_name;

24
Q

Various Syntax in SQL

DROP DATABASE database_name;

A

SQL DROP DATABASE Statement

DROP DATABASE database_name;

25
Q

Various Syntax in SQL

USE database_name;

A

SQL USE Statement

USE database_name;

26
Q

Various Syntax in SQL

COMMIT;

A

SQL COMMIT Statement

27
Q

Various Syntax in SQL

ROLLBACK;

A

SQL ROLLBACK Statement