MySql資料庫的基本操作 表的建立 查詢

2021-06-25 23:58:26 字數 702 閱讀 9562

建立資料表:

首先,建立和開啟乙個資料庫:create database test;

開啟時候,使用use

:use test;

顯示使用者已經開啟的資料庫:select database();

建立資料表:

create table tb1(

-> username varchar(20), //使用者姓名,字元型

-> age tinyint unsigned, //年齡,整形,無符號型別

-> salary float(8,2) unsigned //工資,浮點型,共

8位,小數後兩位,無符號型

-> );

檢視(當前)資料表:show tables;

檢視其他資料庫的資料表:show tables from mysql;

檢視資料表的結構:show columns from tbl_name;

一直在 

學習,感覺不錯。

MySQL資料庫 表的基本操作

操作時,記得先切換到資料庫下 作用命令 檢視所有表show tables 檢視表結構desc 表名 show columns from 表名 檢視表內容select from 表名 新建表 沒有庫名 create table if not exists 表名 id int,name char 30 ...

mysql資料庫表的基本操作

先放一張mysql基本型別的表吧!表裡面是我們常用建立表時候用到都資料型別 mariadb workspace create table user id int,name varchar 32 comment 使用者名稱 password char 32 comment 密碼是32位 birthda...

MySQL 資料庫 表的基本操作

三 運算元據表 四 操作表中資料 資料庫是在資料管理和程式開發過程中,一種非常重要的資料管理方法,通過資料庫,可以非常方便的對資料進行管理操作 資料庫是資料的倉庫,資料庫按照一定的資料格式,結構來儲存資料,方便資料和操作和管理。mysql中小型資料庫,跨平台,開源,免費,應用範圍廣 oracle大型...