mysql 最基本的操作

来源:互联网 发布:神泣单机数据库 编辑:程序博客网 时间:2024/06/06 02:32

mysql 显示所有的数据库,代码如下:

mysql> show databases;

mysql> show tables;

MySQL显示命令
二、显示命令 
1、显示数据库列表。 
show databases; 
2、显示库中的数据表: 
use mysql;
show tables; 
3、显示数据表的结构: 
describe 表名; 
4、建库: 
create database 库名; 
5、建表: 
use 库名; 
create table 表名 (字段设定列表); 
6、删库和删表: 
drop database 库名; 
drop table 表名; 
7、将表中记录清空: 
delete from 表名; 
8、显示表中的记录: 
select * from 表名

[喝小酒的网摘]http://blog.const.net.cn/a/1854.htm


1.TRUNCATE TABLE:将表中记录清空; 

TRUNCATE TABLE table_name

2. SELECT INTO:备份表

SELECT * INTO new_table_name FROMoriginal_table_name

 

3.其他的SQL学习

•             SQL 可在数据库中创建存储过程

•             SQL 可在数据库中创建视图

•             SQL 可以设置表、存储过程和视图的权限


0 0