+ 3
SQL question
one question on my assignment says: write an SQL statement to create a table named 'countries' including columns: country_id, country_name and region_id which already exists. (2 marks) how do I create a table which already exists? what I have written is: CREATE TABLE countries (country_id INT (8), country_name CHAR (16), region_id INT(8)); is this correct?
6 Respuestas
+ 24
Maybe use drop table countries to completely remove the existing table.
Then you can make a new table of that name.
I would suggest varchar2 instead of char :/
+ 5
I read it as the columns already exist. Not the table. I would ask the teacher for claification.
If the table containing the columns already exists then
SELECT * INTO countries FROM existingTable
Obviously replace * with column names
+ 1
best way is just practice on Real time servers
+ 1
better to check on syntaxes SQL>set server output on;
0
the statement you created is correct, you can make use of varchar2 instead of char. if you want to retain the existing table, then you can opt for rename command , and rename the existing table and create yours.so that you will not lose any data from the existing table.
0
google it broo...