Podcast
Questions and Answers
What SQL keyword is used to change an attribute's definition without renaming it?
What SQL keyword is used to change an attribute's definition without renaming it?
- CHANGE
- ALTER
- MODIFY (correct)
- UPDATE
Which statement correctly changes the fax
attribute to a new name and data type in the Personnes
table?
Which statement correctly changes the fax
attribute to a new name and data type in the Personnes
table?
- ALTER TABLE Personnes CHANGE fax num_fax VARCHAR(14); (correct)
- ALTER TABLE Personnes RENAME fax TO num_fax VARCHAR(14);
- UPDATE TABLE Personnes SET fax = num_fax VARCHAR(14);
- MODIFY TABLE Personnes CHANGE fax num_fax VARCHAR(14);
What is a potential risk when changing the data type of an attribute?
What is a potential risk when changing the data type of an attribute?
- Only char types are allowed.
- The attribute name must be the same.
- Existing values might be reset to zero. (correct)
- New attributes cannot be added.
Which SQL command would correctly change the fax
column's data type to a larger size without renaming it?
Which SQL command would correctly change the fax
column's data type to a larger size without renaming it?
If you want to use the ALTER TABLE
statement to change the definition of fax
to num_fax
, which aspects must be specified?
If you want to use the ALTER TABLE
statement to change the definition of fax
to num_fax
, which aspects must be specified?
Flashcards
ALTER TABLE MODIFY
ALTER TABLE MODIFY
Modifies an attribute's data type without changing its name in a database table.
ALTER TABLE CHANGE
ALTER TABLE CHANGE
Modifies an attribute's name and data type simultaneously in a database table.
ALTER TABLE
ALTER TABLE
A SQL statement used to alter the structure of a database table, including attribute definitions.
Data type
Data type
Signup and view all the flashcards
Data Loss
Data Loss
Signup and view all the flashcards
Study Notes
Changing Attribute Definition
-
To change an attribute definition without renaming it, use ALTER TABLE relation MODIFY attribut definition_relative
-
Example: ALTER TABLE Personnes MODIFY fax VARCHAR(14)
-
To change an attribute definition and rename it, use ALTER TABLE relation CHANGE attribut definition_absolue
-
Example: ALTER TABLE Personnes CHANGE fax num_fax VARCHAR(14)
-
Caution: If the new data type is incompatible with existing values in the table, those values might be modified or set to zero.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.