Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Details of the process for Mysql to create a datasheet

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the details of the data table creation process of Mysql. I hope I can supplement and update some knowledge for you. If you have any other questions you need to know, you can continue to follow my updated article in the industry information. The data table is one of the most important parts of the database and the basis of other objects. If our database does not have data tables, there is no real place to store data (recommended course: MySQL tutorial)

Open the database

We log in to mysql and open the database we want to open.

USE keyword

We open the database named test and command:

USE test

After opening the database, let's create a data table. let's take a look at the command rules for creating a data table.

CREATE TABLE [IF NOT EXISTS] table_name (column_name data_type, column_name data_type,...)

Parameter description

The name of the column_ name column data_type data type

Let's create a basic data table, user name, age, password, salary.

CREATE TABLE ta1 (usename VARCHAR (20), age TINYINT UNSIGNED, passwrod VARCHAR (16), gz FLOAT (8) UNSIGNED)

For the above command, we declare a data table as ta1. The data table has four fields.

A user name with a usename field of 1 to 20 characters

The age field is a number of 0255and UNSIGINED is represented as an unsigned type

Passwords with 1 to 16 characters in the passwrod field

The gz field is 8 digits, 2 decimal places, and UNSIGINED is represented as an unsigned type

After we have created the data table, let's check to see if it has been created successfully.

Command rule

SHOW TABLES [FROM ab_name] [LINK 'pattern' | WHERE expr]

Enter the command to view the datasheet:

SHOW TABLES

After looking at the data table, let's check to see if the data structure of the data table is the same as the one we created.

View the command rules for the data structure:

SHOW COLUMNS FROM table_Name

Enter commands to view the data structure

SHOW COLUMNS FROM user

We can see that the data structure is exactly the same as it was specified when it was created.

These are the details of the data table creation process of Mysql. Please pay attention to other related articles for more information.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report