mysql-table Operation

Source: Internet
Author: User
Tags create database

I. Introduction of the Table

Table is equivalent to a file, a record in the table is equivalent to a row of the file, but a record in the table has a corresponding title, called the table field

Id Name Age Sex
1 Mc 18 Male
2 CW 20 Female
3 MW 24 Male

Id,name,qq,age is called a field, and the rest, a row of content is called a record. row Field column data

Second, the creation of the table

 #语法: Create TABLE table name (field name 1 type [(width) constraint], field name 2 Type [(width) constraint], field name 3 Type [(width) constraint]); Note: 1. In the same table, the field names cannot be the same as 2. Width and constraints are optional 3. The field name and type are required 
Mysql> CREATE DATABASE TT character set UTF8; Query OK, 1 row Affected (0.00 sec) mysql> use tt;database changedmysql> CREATE TABLE t1 (id int, n Ame varchar (+), sex enum (' Male ', ' female '), age int (3); Query OK, 0 rows affected (0.10 sec) mysql> show tables;+--------------+| Tables_in_tt |+--------------+| T1 |+--------------+1 row in Set (0.00 sec) mysql> desc t1;+-------+-----------------------+------+-----+----- ----+-------+| Field | Type | Null | Key | Default | Extra |+-------+-----------------------+------+-----+---------+-------+| ID | Int (11) |     YES | |       NULL | || name | varchar (50) |     YES | |       NULL | || sex | Enum (' Male ', ' female ') |     YES | |       NULL | || Age | Int (3) |     YES | |       NULL | |+-------+-----------------------+------+-----+---------+-------+4 rows in Set (0.01 sec) mysql> Select Id,name,sex , AGe from T1; Empty Set (0.00 sec) mysql> select * from T1; Empty Set (0.00 sec) mysql> Select id,name,sex from T1; Empty Set (0.00 sec)

  

  

mysql-table Operation

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.