The CREATE TABLE [dbo] [tb_jsr] (
[id]/int IDENTITY (1, 1) NOT NULL,
[name] [varchar] (15) NOT NULL,
[sex] [char] (2) the NULL,
[age] [int] NULL,
[tel] [varchar] (20) NULL,
[the enable] [bit] NOT NULL,
PRIMARY KEY CONSTRAINT [PK_tb_jsr] CLUSTERED
(
[id] ASC
) WITH (PAD_INDEX=OFF, STATISTICS_NORECOMPUTE=OFF, IGNORE_DUP_KEY=OFF, ALLOW_ROW_LOCKS=ON, ALLOW_PAGE_LOCKS=ON) ON (PRIMARY)
) ON the (PRIMARY)
I now use the oracle database as the database of the project, could you tell me the great spirit, the following constraints in oracle should be how to write SQL table? It is best to put the following constraints that piece of code to analyze the word for word, thank you very much ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
CodePudding user response:
A,,,,,,,,,,CodePudding user response:
- spare nothing, to write you a look at
- 1. Oracle is not on the column, with a seq + tri implementation
2 - bit data type does not exist, it is recommended to use int instead of
- 3. No clustered index (or end)
SQL>
SQL> The CREATE TABLE tb_jsr (
2 id int the NOT NULL,
3 the name varchar (15) NOT NULL,
4 sex char (2) the NULL,
Five age int NULL,
6 tel varchar (20) NULL,
7 the enable int the NOT NULL
8);
The Table created
SQL> The create sequence seq_tb_jsr;
The Sequence created
SQL> Create the trigger ins_tb_jsr
2 before the insert on tb_jsr
3 for each row
4 the begin
5: the new id:=seq_tb_jsr nextval;
6 the end;
7/
The Trigger created
SQL> The alter table tb_jsr add constraint PK_tb_jsr primary key (id);
Table altered
SQL> Drop table tb_jsr purge;
Table dropped
SQL> The drop sequence seq_tb_jsr;
The Sequence dropped
SQL>
CodePudding user response:
Thank you for being lateCodePudding user response:
For more than two years, you would have launched the project?