網(wǎng)站的整套解決方案包括: 開發(fā)語言 操作系統(tǒng) web服務器軟件 數(shù)據(jù)庫軟件
開源和閉源
Structured Query Language:結(jié)構(gòu)化查詢語言, 用于程序員和數(shù)據(jù)庫軟件(DBMS)進行交流
如何連接數(shù)據(jù)庫軟件: 檢查mysql服務開啟 window鍵+r 輸入services.msc
開始菜單中找到Mysql/MariaDB文件夾 里面的 Mysql Client 打開后直接輸入密碼
如果是linux或mac系統(tǒng) 先打開終端 在終端中輸入 mysql -u用戶名 -p回車 回車后輸入密碼 回車
斷開連接: 關閉窗口 或執(zhí)行 exit;
Access denied for user 'root'@'localhost' (using password: YES) 密碼錯誤
show databases;
create database db1;
create database db2 character set utf8;
create database db3 character set gbk;
show create database db1;
drop database db4;
use db1;
create database mydb1 character set utf8;
create database mydb2 character set gbk;
show databases;
show create database mydb1;
show create database mydb2;
use mydb1;
use mydb2;
drop database mydb1;
drop database mydb2;
create table student(name varchar(10),age int);
create table person(name varchar(10),gender varchar(5))charset=gbk;
show create table person;
desc student;
drop table student;
rename table person to t_person;
alter table t_person add salary int;
alter table t_person add id int first;
alter table t_person add age int after name;
alter table t_person drop salary;
alter table t_person change age salary int;
create table t1(name varchar(10),age int)charset=utf8;
show tables;
show create table t1;
desc t1
drop table t1;
rename table t1 to t2;
alter table t1 add salary int first/ after xxx;
alter table t1 drop salary;
alter table t1 change
原名 新名 新類型;create database mydb1 character set utf8;
use mydb1;
create table emp(name varchar(10)) charset=utf8;
alter table emp add age int;
alter table emp add id int first;
alter table emp add gender varchar(5) after name;
alter table emp change gender sal int;
alter table emp drop age;
rename table emp to t_emp;
drop table t_emp;
drop database mydb1;
###數(shù)據(jù)相關SQL
create database mydb2 character set utf8;
use mydb2;
create table person(name varchar(10),age int)charset=utf8;
insert into person values('Tom',18);
insert into person(name)values('Jerry');
insert into person(name)values('zhangsan'),('lisi');
insert into person values('劉德華',30);
如果執(zhí)行以上代碼出現(xiàn)錯誤提示,提示里面包含16進制的錯誤信息 執(zhí)行以下SQL
set names gbk;
select name from person;
select name,age from person where age>20;
select * from person;
update person set age=8 where name='Tom';
update person set age=10 where age is null;
delete from person where name='Tom';
2. 刪除年齡小于20歲的
delete from person where age<20;
3. 刪除所有數(shù)據(jù)
delete from person;
create table t1(name varchar(10),age int(10) zerofill);
insert into t1 values('Tom',18);
select * from t1;
create table t_date(t1 date,t2 time,t3 datetime,t4 timestamp);
insert into t_date values('2020-1-18',null,null,null);
insert into t_date values(null,'17:35:18','2020-3-17 12:30:23',null);
Java、Python、算法知識體系 | PPT、簡歷模板 | 游戲源碼 | IT行業(yè)趣味資訊 | 裝機必備軟件
關注下方公號回復【資料】獲取 👇🏻👇🏻👇🏻
聯(lián)系客服