SQL introduction Classic (5th Edition) Learning Notes (3)
1. Can the following CREATE TABLE command be executed properly? What changes need to be made? Are there any restrictions on execution in different databases (MySQL, Oracle, SQL Server)?
Do not as:
Middle_name null
2. Can I delete a field from the table?
Can alter drop coloum??
3. What statement should be used to create a primary key constraint in the previous table employee _ TBL?
Alter table EMPLOYEE_TBL add constraint emp_pk primary key (id)
4. In order for the MIDDLE_NAME field in the previous table employee _ TBL to accept null values, what statement should be used?
Alter table EMPLOYEE_TBL modify MIDDLE_NAME varchar2 (20) null
5. What statement should be used so that the personnel records added in the previous table EMPLOYEE_TBL can only be located in New York State ('NY')?
Alter table EMPLOYEE_TBL add check (state='NY')
6. To add an auto-increment field named EMPID to the previous table employee _ TBL, what statement should be used to match the syntax structure of both MySQL and SQL Server?
Alter table EMPLOYEE_TBL add coloum EMPID int auto_increment