Mysql 建庫 建表 插入資料

2022-08-24 04:09:12 字數 914 閱讀 8283

//檢視所有資料庫

show databases;

//新建test資料庫,建議不要用中文或者關鍵字,如果一定要用的化可以加反引號``引起來 charset 分為utf8 /gbk

create database test charset utf8;

//開啟test資料庫(use沒有退出資料庫的命令,但是可以檢視資料庫後直接用use切換資料庫)

//新建表

create table hpeu_student(

stu_id int not null auto_increment,

stu_name varchar(100) not null,

enroll_date date,

primary key(stu_id)

//檢視表結構

desc 表名;

//插入資料

insert into hpeu_student values(1,'jim',now()),(2,'john',now()),(3,'mike',now());

insert into hpeu_student (stu_name,enroll_date) values ('tim',now()),('joke',now()),('lucy',now());

//檢視表的內容

hive 建庫建表插入資料

hive 建庫建表插入資料 先上傳檔案 sftp put users chenxin downloads hql50 hql50 score.txt root data hql50 sftp put users chenxin downloads hql50 hql50 teacher.txt ro...

筆記 Mysql例項 建庫建表並插入資料1

drop database if exists school 如果存在school則刪除 create database school 建立庫school use school 開啟庫school create table teacher 建立表teacher id int 3 auto incre...

mysql建立使用者表 mysql 建庫建表建使用者

1.建立資料庫 create database school 2.使用資料庫 use school 3.建立使用者 create user jame localhost identified by jame 4.授權使用者 注意這裡是用了 哦,可以自己講school也替換成 號 grant sele...