mysql的基本命令介紹
發表時間:2023-05-29 來源:明輝站整理相關軟件相關文章人氣:
[摘要]本篇文章給大家帶來的內容是關于mysql的基本命令介紹,有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。前端狗初學MySQL,記錄一下1、用戶登錄:mysql -uroot -p2、查...
本篇文章給大家帶來的內容是關于mysql的基本命令介紹,有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。
前端狗初學MySQL,記錄一下
1、用戶登錄:
mysql -uroot -p
2、查看數據庫:
show databases;
3、創建數據庫:
create database firstsql;
4、進入數據庫:
use firstsql
5、查看數據庫中的所有表:
show tables;
6、創建表:
create table student(
ID char(7) primary key,
NAME varchar(20) not null,
Age varchar(20) default '10'
)comment='信息';
設置ID作為主鍵,NAME的值不能為空,Age 的默認值是10,備注為信息。
7、查看表結構
desc firstsql.student;
8、查看表格創建信息
show create table student;
9、查看表數據
select * from student;
select ID,NAME,Age from Student;
select * from Student where ID='001';
10、插入數據
insert into student values ('001','二哈','計算機');
11、刪除數據
delete from student;
delete from student where ID='001';
12、修改數據
update student set NAME='物聯網' where ID='001';
以上就是mysql的基本命令介紹的詳細內容,更多請關注php中文網其它相關文章!
學習教程快速掌握從入門到精通的SQL知識。