日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

【Mysql】mysql基本操作

發布時間:2023/12/3 数据库 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Mysql】mysql基本操作 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

創建

創建擁有三個字段的表單

create table qq(id int primary key auto_increment ,username varchar(100) ,password varchar(100) )DEFAULT CHARSET=utf8mb4;

關于編碼問題,如果顯示問號,則可以在后面加個utf8

CREATE TABLE IF NOT EXISTS `father_module_info` (`id` int(11) DEFAULT NULL,`module_name` char(66) DEFAULT NULL,`show_order` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

刪除:

刪除數據庫:
DROP DATABASE 數據庫名;
刪除表單:
DROP TABLE 表單名;

關于字段

創建表單并添加單個數據

Create table Student( Sno varchar(10) primary key )

向表單中添加字段

alter table Student add Sne varchar(10) not null
alter table Studentadd axba varchar(10) not null
alter table Student add time int notnull

在表單中刪除字段

alter table Student drop column axba;

修改字段

ALTER TABLE user MODIFY email VARCHAR(20) NOT NULL;

關于內容

向單個表添加一行內容
insert INTO user(user, password) values (‘liuxing’,‘123456’);
修改某行中的單個數據
update Student set Sne=‘啊啊啊’ where Sno=‘張三’
刪除某一列的信息:
delete from student where name=’tom’;

創建關聯表
創建user表

create table user (id int primary key auto_increment,username varchar(200) not null,birthday datetime DEFAULT null,sex char(1) DEFAULT null,address varchar(200) DEFAULT null )DEFAULT CHARSET=utf8mb4;

創建外聯user的account表

create table account (id int primary key not null,uid int DEFAULT null,money double DEFAULT null,foreign key(uid) REFERENCES user(id) )DEFAULT CHARSET=utf8mb4;

總結

以上是生活随笔為你收集整理的【Mysql】mysql基本操作的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。