Mysql Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

CHAR datatype

A

1) fixed length
2) given length of the string less than given fixed length ->length = fixed length

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

Add primary key to a relation

A

ALTER TABLE tablename ADD PRIMARY KEY

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

Add an attribute to an existing table

A

ALTER TABLE table_name ADD attribute name DATATYPE;

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

Modify datatype of an attribute

A

ALTER TABLE table_name MODIFY attribute DATATYPE

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

Modify constraint of an attribute

A

ALTER TABLE table_name MODIFY attribute DATATYPE NOT NULL;

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

Remove an attribute

A

ALTER TABLE table_name DROP attribute

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

Remove primary key from the table

A

ALTER TABLE table_name DROP PRIMARY KEY;

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

drop a table

A

DROP TABLE table_name;

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

drop a database

A

DROP DATABASE database_name;

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

Renaming of columns

A

SELECT EName as Name FROM EMPLOYEE;

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

Distinct Clause

A

SELECT DISTINCT DeptId FROM EMPLOYEE;

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

Data Updation

A

tax:
UPDATE table_name
SET attribute1 = value1, attribute2 = value2, …
WHERE condition;

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