mysql資料庫怎樣建立表,MYsql資料庫怎樣建立表? 20

時間 2021-10-16 11:01:39

1樓:歐覓潘安然

比如要建立學生表表名為student,學生表有欄位學號(no),年齡(age)

create

table

student(

no int

primary

key(主鍵),

age int

);執行下就建立好了

隨便舉的例子,明白吧?謝謝採納!

2樓:

create database cookbook; 建立一個叫“cookbook”的資料庫

use cookbook; 使用cookbook這個資料庫create table limbs (thing varchar(20),legs int,arms int); 建立表“limbs”其中包括thing,legs,aems 欄位

建立表的命令是 create table 表名稱後面括號裡的內容是表中欄位的屬性

3樓:匿名使用者

建議你使用一些mysql的客戶端工具我一直在使用sqlyong。這個工具比較不錯!

4樓:匿名使用者

進到mysql 客戶端,或者使用phpmyadmin,執行如下命令:

drop table if exists `tbltable1`;

create table `tbltable1` (`ino` int(11) not null auto_increment,

`strfieldname` varchar(255) not null,

`intorder` tinyint(4) default 0,primary key (`ino`)

) engine=myisam default charset=utf8 row_format=dynamic comment='資料表1';

mysql資料庫中怎麼建立一個表呢?

5樓:匿名使用者

進入mysql的命令視窗,敲命令:

create database 資料庫名;

use 資料庫名;

create table 表名(id int(4) not null primary key auot_increment; 欄位名 資料型別;)

6樓:匿名使用者

有帶介面的啊,我用的就是,不知道咋給你

mysql資料庫怎麼建立資料表並新增資料

7樓:黑馬程式設計師

1、建立一個資料庫test2

**:mysql> create database test2;

截圖:2、建立一個mytable表

**:  mysql> create table mytable (name varchar(20), *** char(1),

-> birth date, birthaddr varchar(20));

截圖:3、顯示錶結構

**:mysql> describe mytable;

截圖:4、向表中插入一條記錄

**:mysql> insert into mytable-> values(

-> 'abc','f','1988-07-07','chian');截圖:

8樓:熱愛資料庫的同學

建立mysql資料表需要以下資訊:

表名、表欄位名、定義每個表欄位

語法

以下為建立mysql資料表的sql通用語法:

例項

以下例子中我們將在 shulanxt 資料庫中建立資料表shulanxt_tbl:

from 樹懶學堂 - 一站式資料知識平臺

例項解析:

如果你不想欄位為 null 可以設定欄位的屬性為 not null, 在運算元據庫時如果輸入該欄位的資料為null ,就會報錯。

auto_increment定義列為自增的屬性,一般用於主鍵,數值會自動加1。

primary key關鍵字用於定義列為主鍵。 您可以使用多列來定義主鍵,列間以逗號分隔。

engine 設定儲存引擎,charset 設定編碼。

9樓:小q聊科技

使用 create table 語句可完成對錶的建立, create table 的常見形式:

create table 表名稱(列宣告);

以建立 students 表為例, 表中將存放 學號(id)、姓名(name)、性別(***)、年齡(age)、聯絡**(tel) 這些內容:

create table students

(id int unsigned not null auto_increment primary key,

name char(8) not null,

*** char(4) not null,

age tinyint unsigned not null,

tel char(13) null default "-"

);向表中插入資料

insert 語句可以用來將一行或多行資料插到資料庫表中, 使用的一般形式如下:

insert [into] 表名 [(列名1, 列名2, 列名3, ...)] values (值1, 值2, 值3, ...);

其中 內的內容是可選的, 例如, 要給 samp_db 資料庫中的 students 表插入一條記錄, 執行語句:

insert into students values(null, "王剛", "男", 20, "13811371377");

按回車鍵確認後若提示 query ok, 1 row affected (0.05 sec) 表示資料插入成功。 若插入失敗請檢查是否已選擇需要操作的資料庫。

有時我們只需要插入部分資料, 或者不按照列的順序進行插入, 可以使用這樣的形式進行插入:

insert into students (name, ***, age) values("孫麗華", "女", 21);

MYSQL資料庫中怎麼建立表呢,MYSQL資料庫中怎麼建立乙個表呢?

進入mysql的命令視窗,敲命令 create database 資料庫名 use 資料庫名 create table 表名 id int 4 not null primary key auot increment 欄位名 資料型別 有帶介面的啊,我用的就是,不知道咋給你 mysql資料庫怎麼建立資...

mysql建立使用者,怎樣指定管理多個資料庫

mysql 建立乙個使用者 hail,密碼 hail,指定乙個資料庫 haildb 給 hail mysql u root p password use mysql insert into user host,user,password values localhost hail password ...

怎樣在mysql中建立資料庫,如何用MySQL建立資料庫

create database 資料庫名 如何在mysql資料庫中新建乙個資料庫 1 開啟電腦的sql軟體 輸入使用者名稱和密碼,連線上mysql主機位址,將mysql啟動。2 進入mysql裡面後,用滑鼠右鍵點選主機,然後會彈出選單欄,點選裡面的 建立資料庫 也可以使用快捷鍵ctrl d。3 接著...