Today, with MySQL's sub-table problem, you can use scripting to iterate through the creation of a new table, or you can build it using SQL. The following is an example of establishing a player_0 to player_9 statement.Delimiter//CREATE procedure create_table () BEGIN DECLARE ' @i ' int (11); DECLARE ' @sqlstr ' varchar (2560); SET ' @i ' = 0; While the ' @i ' ' @i
1 DROP TABLE IF EXISTS' NuVue ';2 3 CREATE TABLE' NuVue ' (4' ID 'INT(Ten) UNSIGNED not NULLAuto_increment,5' Status 'TINYINT(2) UNSIGNED not NULL DEFAULT 0COMMENT'Status',6' UID 'INT(Ten) UNSIGNED not NULLCOMMENT'Create user',7' province_id 'TINYINT(3) UNSIGNED not NULLCOMMENT'first-class city',8' city_id 'TINYINT(3) UNSIGNED not NULLCOMMENT'Level Two area',9' Name 'VARCHAR( -) not NULLCOMMENT'Site name',T
In MySQL, varchar and char types must specify the length, and the int type does not need to be specified.For exampleSET NAMES UTF8;DROP TABLE IF EXISTS ' Content_Type ';CREATE TABLE ' Content_Type ' (' ID ' BIGINT not NULL auto_increment,' Name ' varchar (+) is not NULL UNIQUE,' Description ' text,' Creator ' VARCHAR (10),' Lastmodifier ' VARCHAR (10),' Createtime ' TIMESTAMP,' LastModifyTime ' TIMESTAMP,PR
Label:CREATE TABLE SALARY (
null,
empname Varchar2 (),
empsalary Number,
hiredate DATE,
PRIMARY KEY (EMPID),
);
INSERT into SALARY VALUES (1, ' Jiang xx ', 1015.32,to_date (' 19950702 ', ' YYYYMMDD '));
COMMIT;
* FROM SALARY;Above how to run all prompt identifier invalid, check half a day only found that the last line in the end more ","In addition, there may not be a list of column names and reserved words are d
1. Create a new tableCREATE TABLEYsb_log (ID Number(8)Primary Key not NULL, Tbdatevarchar( -)NULL, Tb_timevarchar( -) not NULL, Tblogvarchar( -) not NULL, Tbreorvarchar2( -)NULL, BSvarchar( -) not NULL );In Oracle, sequence is the so-called serial number, which is automatically incremented each time it is taken, and is typically used where serial numbers need to be sorted.2. Create a self-incrementCreate1 99999999--the largest paper with 1 by 1 -- keep accumulating, not looping --
Tags: char nextval from Sele enc date next rem bleCreate a table1 Create TableVacationsday2 (3Fldid Number( A) not NULL,4Fldnamevarchar2( $),5 fldbegindata Date,6 fldenddata Date,7Fldselectid Number(Ten)8);Create sequence self-increment 1 create SEQUENCE vacationsday_sequence 2 INCREMENT by 1 -- add several 3 START with 1 -- starting from 1 count Span style= "COLOR: #008080" >4 nomaxvalue -- 5 nocycle -- keep accumulating, not looping 6 CACHE 100 ; Create a TriggerCreate or R
accurate to the secondfunction Time () {var date1=new Date (); Start time var date2=new Date (2016,3,30,0,0,0); End time Var date3=date2.gettime ()-date1.gettime ()///difference in milliseconds//calculates the difference in number of days Var Days=math.floor (date3/(24*3600*1000))// Calculates the number of hours var leave1=date3% (24*3600*1000)//calculates the number of days remaining after the number of milliseconds Var Hours=math.floor (leave1/(3600*1000))//calculates the difference in mi
Tags: workbench flags LOB Tag SQL IMA addition Ted Enc[Intrinsic column Flags] (basic field type identification)-pk:primary Key (column is part of a PK) primary key-Nn:not Null (column is nullable) non-null-Uq:unique (column is part of a unique key) unique-Ai:auto Increment (the column is auto incremented if rows are inserted) self-increment[Additional data type flags, depend on used datatype]-Bin:binary (if DT is a blob or similar, this indicates, which is binary data, rather than text) binary
1.[intrinsic column Flags] (basic field type identification)-pk:primary Key (column is part of a PK) primary key-nn:not Null (column is nullable) non-null-uq:unique (column is part of a unique key) unique-Ai:auto Increment (the column is auto incremented if rows are inserted) self-incrementwww.2cto.com[Additional data type flags, depend on used datatype]-Bin:binary (if DT is a blob or similar, this indicates is binary data, rather than text) binary (larger binary than text) -un:unsigned (for int
Tags: mysql[Intrinsic column Flags] (basic field type identification)-pk:primary Key (column is part of a PK) primary key-Nn:not null (column is nullable) non-null-uq:unique (column is part of a uni Que key) unique-Ai:auto increment (the column is auto incremented if rows are inserted) self-increment[Additional data type flags, depend on used datatype]-Bin:binary (if DT is a blob or similar, this indicates is binary data, rather than text) binary (larger binary than text)-UN: unsigned (for-integ
Benefits of establishing a foreign key:1) Data integrity is ensured by the database, and the integrity is more reliable than the programMultiple applications (if there is an association between an entity with an application a,b,c them), it is difficult for the program to ensure data integrity2) FOREIGN KEY constraints make the ER diagram of the database more readable and facilitate the design of business logicBenefits of not establishing foreign keys:1) Data integrity can be guaranteed with a tr
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.