1. 程式人生 > 資料庫 >第一節----MySQL概述

第一節----MySQL概述

①常見命令:

--顯示資料庫
show databases;
--進入某個資料庫
use sys;
--檢視當前庫的所有表
show tables;
----檢視其他庫的所有表
show tables from mysql;
--檢視在哪個庫
select database();
--建表
create table stuinfo(id int,name varchar(2));
--查看錶結構
desc stuinfo;
--檢視資料
select * from stuinfo;
--檢視MySQL服務端版本
mysql --V;

②MySQL語法規範

不區分大小寫
每句話用;或\g結尾
各子句一般分行寫
關鍵字不能縮寫也不能分行
用縮排提高語句的可讀性
註釋:
單行註釋:#註釋文字
單行註釋:--註釋文字
多行註釋:/*註釋文字*/