0% found this document useful (0 votes)
3 views2 pages

Juurnal3 SQL

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Juurnal3 SQL

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Journal 3

Title : Alter,Drop , Truncate Commands


Date :12/8/2024
Create following Countries table in SQL and solve the queries.

Field | Type | Null | Key | Default | Extra |


+----------------+--------------+------+-----+---------
+-------+
| LOCATION_ID | decimal(4,0) | YES | | NULL |
|
| STREET_ADDRESS | varchar(40) | YES | | NULL |
|
| POSTAL_CODE | varchar(12) | YES | | NULL |
|
| CITY | varchar(30) | YES | | NULL |
|
| STATE_PROVINCE | varchar(25) | YES | | NULL |
|
+----------------+--------------+------+-----+---------
+-------+
1. Write a SQL statement to rename the table countries to Location

2. Write a SQL statement to add a column region_id to the table locations.

3. Write a SQL statement to add a columns ID as the first column of the table
locations.

4. Write a SQL statement to add a column region_id after state_province to


the table locations.

5. Write a SQL statement change the data type of the column country_id to
integer in the table locations.

6. Write a SQL statement to drop the column city from the table locations.

7. Write a SQL statement to change the name of the column state_province to


state, keeping the data type and size same.

8. Write a SQL statement to add a primary key for the columns location_id in
the locations table.

9.Write a MySQL statement to drop the existing primary from the table
locations. Ans: ALTER TABLE locations DROP PRIMARY KEY;
10. Truncate table location.
11.Drop Table.

You might also like