1.Atomic Data
 (1) A column with atomic data can't have several values of the same type data in the column.
 (2) The table with atomic data can't have multiple columns with the same of dara.

*The benefits of normal tables
 (1) Normal tables won't have duplicate data, which will reduce the size of database.
 (2) With less data to search through, the queries will be faster.

2.  Completely normal-FIRST NORMAL FORM(1NF)
 (1) Each row of data must contain atomic values.
 (2) Each row of data must Have a unique identifier:Primary Key
   A primary key is a column in the table that makes each record unique.
  .Primary can't be Null.
  .must given a value when the record is inserted.
  .must be compact.
  .Can't be changed.

*"SHOW CREATE TABLE my_contacts(Name);"=> show that how the table could be created.

*"SHOW COLUMNS FROM tablename;"=> Show all the columns in the table and their details.
*"SHOW CREATE DATABASE databasename;"=> same as show create table, it'll print out how the database create.
*"SHOW INDEX FROM tablename;"=> It will display any columns that are indexed and what type of index they have

3.ALTER TABLE my_contacts               // First means put the nes column at first
   ADD COLUMN contact_id INT NOT NULL AUTO_INCREMENT FIRST, // Add new column
   ADD PRIMARY KEY (contact_id);                 // Add primary key

comment 0 trackback 0

1. 創建資料庫:CREATE DATABASE 數據庫名稱;
2. 使用該數據庫:USE 數據庫名稱;
3.建立表格:CREATE TABLE 名稱( 行1, 行2,....,行n );
4.常用的數據類型:CHAR, VARCHAR, BLOB(大量文本), INT, DEC, DATE, DATETIME....., 每種的規則不同。
5.檢察表格:DESC 表格名稱;

6.刪除表格以及所以其中數據:DROP TABLE 名稱;

comment 0 trackback 0