After the first chapter of the basic data operation instructions are practiced, some operations of the database are performed.
Create a table class has two columns: numbers and names:
CREATE table Class (numbers number, names char (20));
This is the name of the case, don't want to add "" "double quotation mark numbers this is the column, number this is the data type
2. When you are building a table, limit which data can be stored
CREATE table Class2 (numbers number not NULL, names char (20));
This is numbers, this column is not allowed to be empty.
CREATE table CLASS3 (numbers number unique, names char (20));
This is numbers data cannot be duplicated, that is, the only
CREATE table CLASS4 (numbers number check (Numbers > 0), name Char (20));
This is a value of numbers that must be greater than 0
CREATE table CLASS5 (numbers number primary key, name Char (20));
This is the creation of a table with a primary key, and the primary key is numbers.
ALTER TABLE CLASS4 add primary key (numbers);
This is the Modify table, set the primary key for CLASS4 to numbers.
ALTER TABLE CLASS3 add primary key (numbers);
Here is to modify the CLASS3 just built the table, but not successful, said that there is already a unique or primary key.
Oracle Learning record two creation tables and other operational exercises