惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
C
Check Point Blog
博客园 - Franky
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
V2EX - 技术
V2EX - 技术
AI
AI
Hacker News - Newest:
Hacker News - Newest: "LLM"
Jina AI
Jina AI
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Hacker News: Front Page
H
Hackread – Cybersecurity News, Data Breaches, AI and More
O
OpenAI News
Attack and Defense Labs
Attack and Defense Labs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
爱范儿
爱范儿
H
Heimdal Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
Google Developers Blog
G
GRAHAM CLULEY
V
V2EX
The Register - Security
The Register - Security
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
Schneier on Security
Schneier on Security
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
Help Net Security
Help Net Security
大猫的无限游戏
大猫的无限游戏
C
CERT Recently Published Vulnerability Notes
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
The Last Watchdog
The Last Watchdog
J
Java Code Geeks
S
Secure Thoughts
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
量子位
NISL@THU
NISL@THU
K
Kaspersky official blog
Engineering at Meta
Engineering at Meta
T
Threatpost
Recent Commits to openclaw:main
Recent Commits to openclaw:main
宝玉的分享
宝玉的分享
Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
博客园_首页
A
Arctic Wolf

博客园 - Hicome

CentOS6 安装svn Nagios的配置文件 ZT 创建 PHP 测试页 ZT 命令行手工备份Ubuntu系统的方法 还原Ubuntu系统备份的方法 ZT SHELL编程实例+条件判断总结 ZT DELL服务器结合nagios硬件监控、报警 ZT CentOS下内存使用率查看 ZT swf文件格式解析入门(文件头解析)ZT 怎样压缩swf文件? ZT 使用NDOUtils将Nagios监控信息存入数据库 ZT 电脑自动重启的原因几处理方法 ZT 通过rpm包安装、配置及卸载mysql ZT DVD+R与DVD-R有什么区别 ZT CentOS 5.5安装apache2.2.17 ZT CentOS 卸载apache ZT Trac 下设置发邮件问题 Centos 下PHP的卸载与安装 ZT Nginx负载均衡 ZT 【M8】使用的一些小技巧 电话,短信,联系人,音乐等功能
mysql的一些操作命令
Hicome · 2011-02-23 · via 博客园 - Hicome

如果要清空表中的所有记录,可以使用下面的两种方法:

  DELETE FROM table1
  TRUNCATE TABLE table1

删除表
删除数据表的操作很简单,同删除数据库的操作类似,使用DROP TABLE语句就可以实现。其格式如下:
drop table dbname table_name ;
其中dbname为要删除的表所在数据库的名,table_name为表的名称。删除表的操作的示例如下:
mysql>use mysql
Database changed
mysql> drop table shili ;
Query OK, 0 rows affected (0.03 sec)

该示例成功删除了MySQL数据库中的shili表。 

 创建数据库

CREATE TABLE t1(

   id int not null,

   name char(20)

);

创建表 

create table employee (employee_id char(6) primary key,name char(8),sex char(2),birthday(date);

create table products (product_id char(2) primary key, name char(20));

察看表结构 

describe employ-ee;

describe products;

向表中添加数据 

insert into employee values (’200301’,’zhangsan’,’m’,’1978/5/8’);

insert into employee values (’200302’,’lisi’,’f’,’1973/3/20’);

insert into employee values (’200303’,’wangwu’,’f’,’1970/10/9’);

insert into employee values (’200304’,’zhaoliu’,’m’,’1975/1/18’);

创建索引 

建表时创建带索引的表

1

create table test1 (test1_id char(4),name char(20), index idx_test1(name(10)));

2

create index idx_employee on employee(name); 用create为name列创建索引

3

alter table products add index idx_products(name); 用alter为name列创建索引

察看索引 

show index from employee;

show index from products;

删除索引 

1

drop index idx_employee on employee;

2

alter table products drop index idx_products;