(1) Mode definition and deletion
First create a user, and then create a mode for the
user. User creation —> select the database used —> security —> right-click the user —> new user,
select the user type without login in the general column Name the SQL user, and then customize the user name, the framework uses the default.
Created for the user mode
over the New Query select the corresponding database (database selected must be careful which one), enter the code
to test the code again run
can re-architecture (SQL schema refers mode) to find patterns created
also You can use the following code to create a schema, and you can also define a table
Delete mode
In SQL, there is no distinction between CASCADE and RESTRICT, only this keyword can be recognized, but the deletion in SQL is deleted by default with RESTRICT
(2) The definition, deletion and modification of the
basic table Define the basic table: create a student Table Student
Create a course table Course
Create a student selection table
Modify the basic table
Three basic tables have been created, now modify
the table Add "Enrollment Time" to the student table
Change the data type of the data in the table Add
the constraint condition of the course name to
delete Basic table
The deletion of the table in SQL is the same as the deletion of the schema. The default is RESTRICT, but only these two keywords can be recognized, so the selected table is directly deleted, and the table cannot be referenced by the constraints of other tables.
Because of the elective course Table SC has to constrain the referenced student table Student, so if you want to delete Student, you have to delete SC together.
Summary:
There is no difference in most operations in SQL. Only the deletion of schema and table needs to be noted. In SQL, CASCADE and RESTRICT cannot be recognized. , But at the same time SQL is deleted by default as RESTRICT. At the same time, it should be noted that the code to create the class can only be run once, and an error will be reported if it is run multiple times.