About creating tables in Mysql

Updated on technology 2024-06-08
6 answers
  1. Anonymous users2024-02-11

    drop table if exists t_user;--If there is a t user table, delete it.

    create table if not exists t_user

    user_id varchar(10) primary key not null,user_name varchar(20) not null,password varchar(20),contact_tel varchar(30),email varchar(30),create_date datetime

    If the t user table does not exist, establish it.

    The benefits of this are; If this table exists, when you create a table table name, an error will be reported, because it already exists, so you can't create the same name.

    But the bad thing about this is that if the original table is useful, then the data in it is gone.

    However, as you wrote, the original data is usually deleted as useless data, so it is avoided to report an error if there is the same table name.

  2. Anonymous users2024-02-10

    exists and does not exist judgment The newly created table can be written directly to create table t user without this judgment

  3. Anonymous users2024-02-09

    It's just to add a judgment.

    drop table if exists t_user;If there is a t user, delete it.

    create table if not exists t t user.

  4. Anonymous users2024-02-08

    Summary. Enter the Create Table command to create a table with the name of the table followed by the command. 2 3 The column fields of the input table are followed by the column fields of the table after the command, each column field is separated by a comma, and the field name is followed by the field type, where auto increment indicates that the field is self-incrementing data.

    3 3 Set the primary key of the table: Use the primary key behind the command to set the primary key of the table. Use the client to create 1 5 Open Table Option Open the client, connect to MySQL and click on the table option on the left. 2 5 Click the Add icon to enter the data table list, and click the Add icon.

    3 5 Add and set columnsClick the plus sign to add columns to set the data type of the column. 4 5 Click the Save button to complete the setting, click the Save button. 5 5 Enter the name of the table In the pop-up window, enter the name of the table.

    Enter the Create Table command to create a table with the name of the table followed by the command. 2 3 The column fields of the input table are followed by the column fields of the table after the command, each column field is separated by a comma, and the field name is followed by the field type, where auto increment indicates that the field is self-incrementing data. 3 3 Set the primary key of the table: Use the primary key behind the command to set the primary key of the table.

    Use the client to create 1 5 Open Table Option Open the client, connect to MySQL and click on the table option on the left. 2 5 Click the Add icon to enter the data table list, and click the Add icon. 3 5 Add and set columnsClick the plus sign to add columns to set the data type of the column.

    4 5 Click the Save button to complete the setting, click the Save button. 5 5 Enter the name of the table In the pop-up window, enter the name of the table.

    mysql statement to create a table, thanks.

    create table customers(cust_id int not null auto_increment,cust_name char(50) not null,cust_address char(50) null,cust_city char(50) null,cust_state char(5) null,cust_zip char(10) null,cust_country char(50) null,cust_contact char(50) null,cust_email char(255) nullprimary key (cust_id))engine = innodb;

  5. Anonymous users2024-02-07

    MySQL describes how to create a data table:Computer: matebook14

    System: Windows 10

    Software: 1. Open the client, connect to MySQL and click the table option on the left. Pitan hail.

    2. Enter the data table list and click the add icon.

    3. Click the plus sign to add a column and set the data type of the column.

    4. After the setting is completed, click Save and press the letter button.

    5. In the pop-up window, enter the name of the sail on the table.

  6. Anonymous users2024-02-06

    The MySQL database system can support many different databases, and typically, one database is required for each application.

    In the book-o-rama example, the database is named books.

    Creating a database is the easiest part of Zen. At the mysql command prompt, enter the following command:

    mysql>createdatebasedbnameï¼›

    It should be replaced with the desired number of stealth spring database names"dbname"String.

    In the book-o-rama example, you want to create a database called books.

    You should just see a response like the following (execution time will vary from machine to machine):

    queryok, 1rowaffected (If the appeal field appears it means everything is fine.)

    If you don't get a response, make sure to enter a semicolon after the command line above, the semicolon will tell MySQL that it is time to execute the command.

Related questions
5 answers2024-06-08

1,MySQL database is indeed free,People say it's sending 50M space,It's your ** running on someone else's server.,People give you.。 >>>More

6 answers2024-06-08

Test environment: winxp+sql server2000:

primary key means that this table is the primary key. If you only want to add columns automatically, you can leave this statement unnecessary. >>>More

6 answers2024-06-08

You need to write a stored procedure that can do the above functionality! After all, what you're describing has a branching structure!

5 answers2024-06-08

1.You don't have to convert it to word format, just print it and fill it in by hand. >>>More

5 answers2024-06-08

It seems that there is something called triggers in the DB, and there seems to be another thing called transactions.