Lecture 20 Flashcards

1
Q

SQL for inserting

A

INSERT INTO EMPLOYEE(Name, SSN)
SELECT Pname, Pssn FROM PERSON

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

how to delete table SQL

A

DROP TABLE EMPLOYEE

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

how to delete the column from table SQL

A

ALTER TABLE EMPLOYEE
DROP COLUMN Name CASCADE

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

how to add a new column to table SQL?

A

ALTER TABLE EMPLOYEE
ADD COLUMN Hobby VARCHAR(10) DEFAULT ‘NA’

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

how to modify default value for attribute

A

ALTER TABLE EMPLOYEE ALTER COLUMN Hobby DROP DEFAULT
SET DEFAULT ‘Football’

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

how to add constraint in SQL

A

ALTER TABLE EMPLOYEE
ADD CONSTRAINT constraint_name UNIQUE(Name)

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

how to delete the records with particular value

A

DELETE FROM EMPLOYEE
WHERE Value=‘Cho-to-tam’

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

How to set the value of attribute to something for the employee with key = 1234

A

UPDATE EMPLOYEE
SET Attribute=‘something’
WHERE SSN=1234

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