Basic database operations (linux system)

database job

MySQL under linux system

create database

insert image description here

use database

insert image description here

Query the current default database and the encoding verification rules used

insert image description here

Query statement to create data

insert image description here

delete database

insert image description here

Create data table

Define multiple fields and use all data types
insert image description here

mysql> SHOW CREATE TABLE multi_tb;
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table    | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| multi_tb | CREATE TABLE `multi_tb` (
  `company_name` char(8) DEFAULT NULL COMMENT '公司名称',
  `introduce` varchar(100) DEFAULT NULL COMMENT '介绍',
  `content1` tinytext COMMENT '公司员工名',
  `content2` text COMMENT '内容1',
  `content3` mediumtext COMMENT '内容2',
  `content4` longtext COMMENT '内容3',
  `picture1` blob COMMENT '图片1',
  `picture2` mediumblob COMMENT '大图片',
  `picture3` longblob COMMENT '视频',
  `list` enum('X1','X2','X3') DEFAULT NULL COMMENT '选择列表',
  `list1` set('Y1','Y2','Y3','Y4') DEFAULT NULL COMMENT '公司的职业',
  `people1` tinyint DEFAULT NULL COMMENT '管理层人数',
  `area` smallint DEFAULT NULL COMMENT '公司面积',
  `gong_shu` mediumint DEFAULT NULL COMMENT '公司流动资金',
  `money` int DEFAULT NULL COMMENT '投资资金',
  `people2` bigint DEFAULT NULL COMMENT '公司员工编号',
  `wages` float(8,3) DEFAULT NULL COMMENT '平均工资',
  `wages_gong` double(10,2) DEFAULT NULL COMMENT '月营业额',
  `wages_nian` decimal(11,2) DEFAULT NULL COMMENT '年营业额',
  `date` date DEFAULT NULL COMMENT '日期',
  `datetime` datetime DEFAULT NULL COMMENT '日期加时间',
  `timestamp` timestamp NULL DEFAULT NULL COMMENT '时间戳',
  `time` time DEFAULT NULL COMMENT '时间',
  `year` year DEFAULT NULL COMMENT '年'
) ENGINE=InnoDB DEFAULT CHARSET=gbk |
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> 


Guess you like

Origin blog.csdn.net/bo1029/article/details/131582160