SQL Queries Flashcards

1
Q

Insert command

A

INSERT INTO EMPLOYEE (name, age, etc)
VALUES (‘Richard’, 25, etc)

or

INSERT INTO EMPLOYEE (name, age, etc)
SELECT name, age, etc
FROM tempemployee
WHERE age > 25

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

Create table following template

A

CREATE TABLE HELLO LIKE BONJOUR
(SELECT
FROM
WHERE)
WITH DATA;

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

DELETE

A

DELETE FROM EMPLOYEE
WHERE Lname=’Richard’;

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

UPDATE

A

UPDATE PROJECT
SET Plocation=’Bellaire’, Dnum=5
WHERE Pnumber=10;

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

Give all employees in research department a 10% increase

A

UPDATE EMPLOYEE
SET SALARY=SALARY*1.1
WHERE Do IN(SELECT DNUMBER
FROM DEPARTMENT
WHERE DNAME=’Research’);

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

Create a view

A

CREATE VIEW blah blah AS
SELECT
FROM
WHERE

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