Home Database Mysql Tutorial MySQL学习笔记2:数据库的基本操作(创建删除查看)

MySQL学习笔记2:数据库的基本操作(创建删除查看)

Jun 07, 2016 pm 05:55 PM
create delete Basic operations Check

我们所安装的MySQL说白了是一个数据库的管理工具,真正有价值的东西在于数据关系型数据库的数据是以表的形式存在的,N个表汇总在一起就成了一个数据库现在来看看数据库的基本操作

我们所安装的MySQL说白了是一个数据库的管理工具,真正有价值的东西在于数据关系型数据库的数据是以表的形式存在的,N个表汇总在一起就成了一个数据库现在来看看数据库的基本操作
无非就是三点:创建 删除 查看

创建数据库
代码如下:
mysql> create database school;
Query OK, 1 row affected (0.00 sec)

create database语句用于创建数据库
后面的school是数据库的名字,分号结束
执行成功则会显示Query OK,还有执行时间
有了数据库之后,一般情况下会查看当前数据库

查看数据库
代码如下:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| school |
| test |
+--------------------+
rows in set (0.00 sec)

这样便显示了创建的数据库,其中school是刚刚创建的
其余几个默认存在,不要乱动
test是给你做测试使用,可以删除

删除数据库
代码如下:
mysql> drop database school;
Query OK, 0 rows affected (0.00 sec)

删除也很简单,drop database 命令即可
接下来就可以使用show databases查看效果要注意的是语句后面不要忘记分号在实际中,我们操作更多的不是数据库,而是数据库中的表所以这里的内容显得很简单
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to delete Xiaohongshu notes How to delete Xiaohongshu notes Mar 21, 2024 pm 08:12 PM

How to delete Xiaohongshu notes

Is it true that you can be blocked and deleted on WeChat and permanently unable to be added? Is it true that you can be blocked and deleted on WeChat and permanently unable to be added? Apr 08, 2024 am 11:41 AM

Is it true that you can be blocked and deleted on WeChat and permanently unable to be added?

Check out the steps to delete a logged-in device on Douyin Check out the steps to delete a logged-in device on Douyin Mar 26, 2024 am 09:01 AM

Check out the steps to delete a logged-in device on Douyin

How to completely delete TikTok chat history How to completely delete TikTok chat history May 07, 2024 am 11:14 AM

How to completely delete TikTok chat history

How to send files to others on TikTok? How to delete files sent to others? How to send files to others on TikTok? How to delete files sent to others? Mar 22, 2024 am 08:30 AM

How to send files to others on TikTok? How to delete files sent to others?

How can I retrieve someone else's deleted comment on Xiaohongshu? Will it be displayed if someone else's comment is deleted? How can I retrieve someone else's deleted comment on Xiaohongshu? Will it be displayed if someone else's comment is deleted? Mar 21, 2024 pm 10:46 PM

How can I retrieve someone else's deleted comment on Xiaohongshu? Will it be displayed if someone else's comment is deleted?

How to check your own ID on Xianyu_Introduction to how to check your personal nickname on Xianyu How to check your own ID on Xianyu_Introduction to how to check your personal nickname on Xianyu Mar 22, 2024 am 08:21 AM

How to check your own ID on Xianyu_Introduction to how to check your personal nickname on Xianyu

PHP Practical Tip: Remove the last semicolon in your code PHP Practical Tip: Remove the last semicolon in your code Mar 27, 2024 pm 02:24 PM

PHP Practical Tip: Remove the last semicolon in your code

See all articles