Home > Database > Mysql Tutorial > body text

MySQL中基本操作(数据库创建,修改,删除,数据表创建,修改,

WBOY
Release: 2016-06-07 15:25:50
Original
1009 people have browsed it

今天开始,自己开始了新的领域,开始学习SQL数据库,那么就从最基本开始吧~~追赶大神脚步,今天说说数据库基本操作 数据库操作 在MySQL的DOS环境下,完成这样的动作: show databases;create database example;showdatabases;show character set;alter datab

         今天开始,自己开始了新的领域,开始学习SQL数据库,那么就从最基本开始吧~~追赶大神脚步,今天说说数据库基本操作

        数据库操作

        在MySQL的DOS环境下,完成这样的动作:

      

show databases;
create database example;
showdatabases;
show character set;
alter databases example character set gbk;
drop database example;
show databases;
Copy after login

从第一句开始,到最后一句的解释

1、就是察看已存在的数据库

2、创建一个名为example的数据库

3、再次显示已存在的数据库

4、察看所有的字符集

5、将数据库example的字符集改为gbk

6、删除example数据库

7、最终显示数据库


      数据表的操作

create database example;--创建example数据库
use example;--选择数据库
create table student
(
id int,
name varchar(20),
score double
);--创建一个名为student的数据表
show tables;--显示已存在数据表
alter table student
add chinese double;--数据表student中增加chinese列
alter table student
modify name verchar(200);--修改列
alter table student
change chinese math double;
desc student;--显示数据表student
drop table student;--删除数据表student
show tables;
Copy after login

这些全部就是对数据库和数据表的基本操作,实验就清楚了~~
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!