Home > Database > Mysql Tutorial > body text

mysql知识点总结_MySQL

WBOY
Release: 2016-06-01 13:47:51
Original
1050 people have browsed it

bitsCN.com

一、数据库管理:      1.查看数据库      mysql>show databases;    2.创建数据库      mysql>create database 数据库名;    3.使用数据库      mysql>use 数据库名;    4.删除数据库      mysql>drop database 数据库名;

二、数据表管理:    1.查看数据库表      mysql>show tables;        2.查看数据表结构      mysql>desc 数据库表名;      mysql>show create table 表名G;    3.创建数据库表      mysql>create table 数据库表名 (列名   类型   修饰符);      4.删除数据库表      mysql>drop table 数据库表名;     5.修改,添加,删除,字段改名,字段排列顺序,更改表名:       mysql>alter table 表名 modify 需要修改的字段 修改的类型;       mysql>alter table 表名 add 需要添加的新字段名 字段类型;      mysql>alter table 表名 drop 需要删除的字段名;      mysql>alter table 表名 change 原来的字段名 新的字段名 新的字段类型;      mysql>alter table 表名 modify|add| 字段名 字段类型 first|after 字段名;      mysql>alter table 原数据表名 rename 新数据表名;    6.创建有索引的表      mysql>create index 索引名 on 表名 (列表);      或者      mysql>create table 表名 (index index1 (id,name));     7.插入数据      mysql>insert into 表名 (列表名)            values(要插入的数据);       或者      mysql>insert into 表名 set 列表1=数据,列表2=数据;    8.更新数据      mysql>update 表名 set 列名1=数据1,列名2=数据2,...[where clause];         9.删除数据      mysql>delete from 表名 [where clause];     10.查询数据      mysql>select 列名1,列名2 from 表名1,表名2 [where clause];

bitsCN.com
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!