mysql資料表的基本操作

2021-09-12 14:14:28 字數 584 閱讀 9709

理解資料庫表

建立、修改、刪除約束

1.建立資料庫

create database user;
2.建立表

create table emp(

id_db int(10) primary key auto increment,

name_db varchar(20),

***_db varchar(5)

);

3.檢視資料庫,和檢視表。

檢視資料庫

show databases;
連線資料庫

use user;
檢視表

show tables;
連線表

use emp;
檢視emp表上的所有資訊

select * from emp;
單字段主鍵

primary key

mysql 資料表的基本操作

1.建立表 create database name use database name create tabletable name id int 11 name varchar 25 salary float 2.show tables 顯示當前資料庫的表 3.單字段主鍵,設定主鍵有兩種情況。主...

mysql資料表的基本操作

一 先建立乙個資料庫,然後使用資料庫 資料庫舉例命名為student 1.建立資料庫 create database student 2.使用資料庫 use student 二 建立乙個儲存資訊的資料表 命名為test create table test name varchar 25 age in...

mysql 資料表的基本操作

create table table name column name int not null auto increment primary key,column name varchar 20 unique,desc table name select create table table na...