01-mySQL 入门基础命令

MySQL基础命令学习
1.认识标识

Enter password:*******

进入正常的命令窗口的标识符。
在这里插入图片描述
1.显示所有存在的数据库:show databases;
2.链接其中的一个数据库:use <database name>;
3.创建数据库:create database <database name>;
4.显示数据库中所有的表:show tables from <database name>;或者select <database name>();
5.显示表中所有列(内容):show cloumns from <table name>;或者desc <table name>;
6.在数据库中新建表:create table <table name>(字段名1 数据类型,字段名2 数据类型,字段名3 数据类型,...);例如:create table test(name char(10),year int,sex char(4));
7.删除表:drop table <table name>;
8.在表中增加字段:alter table <table name> add 字段名 数据类型,add 字段名2 数据类型2;
9.删除表中的字段:alter table <table name> drop 字段名1,drop 字段名2;
10.在表中增加数据内容:insert into <table name> (字段1,字段2,字段3) value(值1,值2,值3);注意:当值是字符串时‘值’需要加上双引号。
11.选择表中所有的内容:select * from <table name>;
12.选择表中指定的数据:select 字段1,字段2 from <table name>;或者select * from <table name> where 字段1=“数据”;
13.在表中添加字段到指定的位置:alter table <table name> add 字段名 数据类型 first;添加到第一列/after 字段名2;添加到字段2之后。
14.删除表中的数据:delete from <table name> where 字段名=“值”;
15.更新表中的数据:update <table name> set 字段名=“新值” where 字段名=“值”;
16.更改表名:rename table <old table name> to <new table name>;
(待续…)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值