SQL Commands Flashcards

(19 cards)

1
Q

SELECT

A

Retrieves data

SELECT * FROM Product;

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

INSERT

A

INSERT INTO Product
VALUES ();

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

UPDATE

A

Updates existing table.

UPDATE TABLE SET VendorName = ‘ ‘
WHERE vendorID = ‘ ‘;

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

DELETE

A

Removes records

DELETE FROM Customers
WHERE customerID = 10;

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

CRÉATE

A

Creates a database, table, index, function or view.

CREATE TABLE Vendor
(
vendorID VARCHAR2(5)
);

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

ALTER

A

Alters the structure.

ALTER TABLE Product
ADD (reorderLevel NUMBER(3) DEFAULT 10;

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

DROP

A

Deletes objects;

DROP TABLE Vendor;

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

COMMIT

A

Saves all changes made during the transaction.

COMMIT;

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

ROLLBACK

A

Undoes all changes made.

ROLLBACK;

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

GRANT

A

Assigns new privileges to a user account, allowing access to specific database objects, actions or functions.

GRANT SELECT,
UPDATE ON Employees
TO user1;

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

REVOKE

A

Removed previously granted permissions.

REVOKE UPDATE,
ON Employees
FROM user1;

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

CREATE TABLE

A

CREATE TABLE table_name;

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

ALTER TABLE

A

ALTER TABLE table_name;

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

MODIFY

A

Changes attribute characteristics.

ALTER TABLE Product
MODIFY( P_price decimal 9,2);

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

ADD

A

add new attribute.

ALTER TABLE Product
ADD ( P_Reorder_Qty number(2)
P_Reorder char (1) DEFAULT);

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

DROP TABLE

A

Remove table.

DROP TABLE table_name;

17
Q

CRÉATE INDEX

A

Improve efficiency on frequent data searches.

CREATE INDEX P_Code
ON Product(PCode);

18
Q

CREATE UNIQUE INDEX

A

Prevents a duplicate from being created.

CRÉATE UNIQUE INDEX P_CodeX
ON Product (PCode);

19
Q

DROP INDEX

A

Delete index.

DROP INDEX P_CodeX;