使用MySQL Workbench建立資料庫,建立新的表,向表中添加資料

來源:互聯網
上載者:User

標籤:

初學資料庫,記錄一下所學的知識。我用的MySQL資料庫,使用MySQL Workbench管理。下面簡單介紹一下如何使用MySQL Workbench建立資料庫,建立新的表,為表添加資料。

 

 

點擊中的“加號”表徵圖,建立一個串連,

 

 

 

 

如,先輸入資料庫的帳號密碼,帳號預設為root,填好密碼後 點擊“OK”,串連就建立好了,建立完成後,會出現一個長方形的框框,雙擊它,出現所示頁面

 

 

 

 

點擊圖中的紅圈裡的按鈕,建立一個Schema,即資料庫(個人理解。。),修改一下Name 的值,如  mydatabase ,點擊apply,再點apply,然後點finish  如所示

 

 

 

資料庫就建好了!!!

 

 

接下來就是如何建立表,

首先要     !!!雙擊!!!    一下剛剛建立好的資料庫mydatabase,然後再建立表,不然會出錯,右鍵點擊Tables 然後點擊Create new tables ,填寫表名,以及表列的資訊,之後點擊  apply ,一張表就建完了

 PK: primary key (column is part of a pk)  主鍵

 NN: not null (column is nullable)  是否為空白

-UQ: unique (column is part of a unique key)  外鍵

 AI: auto increment (the column is auto incremented when rows are inserted)  自動增加

  BIN: binary (if dt is a blob or similar, this indicates that is binary data, rather than text)   二進位

 UN: unsigned (for integer types, see docs: “10.2. Numeric Types”)

- ZF: zero fill (rather a display related flag, see docs: “10.2. Numeric Types”)

 出現如下頁面

 

接下來向建好的tb_student表中添加資料

 

 

右鍵點擊tb_student,再點擊select rows  limit 1000

在mysql workbench中向資料庫中的表中添加資料大致就是這個樣子。

以上有什麼說的不對的地方,還請大神多多指教。

使用MySQL Workbench建立資料庫,建立新的表,向表中添加資料

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.