数据库的简单操作

一,数据库

二,数据库的表,列,字段,数据之间的联系

三,数据库增、删、查、改的简单操作

一,数据库(电子化的文件柜/Data)

   数据库“按照数据结构来组织、存储和管理数据的仓库”。是一个长期存储在计算机内的、有组织的、可共享的、统一管理的大量数据的集合。

二,数据库的表,列,字段,数据之间的联系

表:记录的组合 表示同一类事物的组合。(表是数据库最基本的对象,用于存储用户数据,关系数据库的所有操作最终都是围绕数据表运行的)
字段:某一个事物的一个特征,或者说是属性。
列:大部分情况下,列和字段是相同的,但是数据中实际存在的表的列就成为列,在运行时创建的搜索的不存在与实际表中的列就是字段。
数据:即所要储存的。
联系:数据库就是大仓库,表就是仓库中相同属性物品的归类,数据即物品。

三,数据库增、删、查、改的简单操作

连接数据库:mysql> mysql -u<username> -p<password>;
显示所有数据库:mysql> show databases;
选择数据库:mysql> use <database name>;
创建一个数据库:mysql> create database <database name> [charset <charset>]; 
删除一个数据库:mysql> drop database <database name>;
修改数据库名:mysql无法直接修改数据库名!
显示所有表:mysql> show tables;
删除一张表:mysql> drop table <table name>;
修改表名:mysql> rename table <table name> to <new table name>;
清空表:mysql> truncate <table name>;

参考

3.1 登入 密码默认为root

mysql -uroot -p
root
D:\installationpath\phpstudy>mysql -uroot -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.53 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

登入界面
3.2

create database 库名;

创建一个库
3.2

drop+库名;

删
3.3

select*from 名称;

在这里插入图片描述
3.4

update hero set 表中的属性 = 改动数据 where id = 1

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

S1Lu

多谢支持!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值