Mysql學習記錄

2021-09-24 08:06:31 字數 2040 閱讀 6578

一、安裝

彷彿做了場夢,mysql從5.7公升級到8了,世界變化真快。

安裝時會提示輸入密碼,密碼要記住。安裝好後進到workbench看看,熟悉一下有幾個資料庫和哪些**。

二、連線

安裝包裡面有mysql shell,不要用這個進行連線。。。會毀滅你學習的慾望;

使用mysql 8. 0 command line,首先會提示輸入密碼,然後就順利進入了,你會看到mysql>,非常好。

三、使用

1、show databases;

2、use database name;

3、select database();

4、建立**

create table tablename  (    column_name data_type,    column_name data_type  );複製**

create table cats  (    name varchar(100),    age int  );

複製**

5、看看建立好的**

show tables; show columns from tablename; desc tablename;

6、刪掉**

drop table ;

複製**

7、加入資料

insert into table_name(column_name) values (data);複製**
8、看看插入的資料

select * from ;

複製**

9、插入很多行

insert into table_name             (column_name, column_name) values      (value, value),             (value, value),             (value, value);複製**

11、其他事項:

(1)、not null

create table cats2  (    name varchar(100) not null,    age int not null  );複製**

(2)、default value

create table cats3  (    name varchar(20) default 'no name provided',    age int default 99  );複製**

12、make it unique:primary key

create table unique_cats  (    cat_id int not null,    name varchar(100),    age int,    primary key (cat_id)  );複製**

create table unique_cats2 (    cat_id int not null auto_increment,    name varchar(100),    age int,    primary key (cat_id));複製**

create table employees (    id int auto_increment not null,    first_name varchar(255) not null,    last_name varchar(255) not null,    middle_name varchar(255),    age int not null,    current_status varchar(255) not null default 'employed',    primary key(id));複製**

mysql學習記錄 MySQL學習記錄 2

in 子查詢 select from student where id in 1,2 not in 不在其中 select from student where id not in 1,2 is null 是空 select from student where age is null is not...

學習記錄 Mysql

mysql 是官方發布的 乙個為mysql設計的c 語言的api,這個api的作用是使工作更加簡單且容易。mysql 為mysql的c api的再次封裝,它用stl standard template language 開發並編寫,並為c 開發程式設計師提供象操作stl容器一樣方便的運算元據庫的一套...

Mysql 學習記錄

本篇部落格主要記錄一些開發中使用的到一些知識點。cdata 這是乙個xml語法 是的所有在cdata中的資料都不會被解析詳細描述參見 cdata語法 concat 函式用於將多個字串連線成乙個字串注意 如有任何乙個引數為null 則返回值為 null。或許有乙個或多個引數。如果所有引數均為非二進位制...