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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Troy Hunt's Blog
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
T
Tor Project blog
Cisco Talos Blog
Cisco Talos Blog
S
Securelist
L
Lohrmann on Cybersecurity
Security Latest
Security Latest
T
Threatpost
H
Heimdal Security Blog
W
WeLiveSecurity
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
TaoSecurity Blog
TaoSecurity Blog
A
About on SuperTechFans
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
量子位
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
AI
AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
Vercel News
Vercel News
C
Cyber Attacks, Cyber Crime and Cyber Security
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
大猫的无限游戏
大猫的无限游戏
Forbes - Security
Forbes - Security

博客园 - 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;