mysql學習從0開始:表的建立,mysql學習建立

來源:互聯網
上載者:User

mysql學習從0開始:表的建立,mysql學習建立

下面的例子是一個名為 "persons" 的表:

Id LastName FirstName Address City
1 Adams John Oxford Street London
2 Bush George Fifth Avenue New York
3 Carter Thomas Changan Street Beijing

上面的表包含三條記錄(每一條對應一個人)和五個列(Id、姓、名、地址和城市)。

現在我們來建立上面的資料表:

mysql> create table persons( 

                          id int auto_increment not null primary key,

                          Lastname varchar(30),

                          Firstname varchar(30), 

                          Address varchar(30), 

                          City varchar(30) 

                         );

好了現在建立欄目成功了。

使用命令 select * from  persons看一下是不是提示empty set,那就對了,因為還沒有添加任何具體資料,到目前為止還是只是建立了欄目而已。

那麼現在來添加資料好了:

mysql> insert into persons(Lastname,Firstname,Address,City)  values  ("Adams","John","Oxford Street","London");

在依照上面insert命令添加另外兩組資料就可以完成整個表格的建立了。

insert into persons(Lastname,Firstname,Address,City) values ("Bush","George"," Fifth Avenue","New York");

insert into persons(Lastname,Firstname,Address,City) values ("Carter","Thomas","Changan Street","Beijing");

今天就總結一下表的建立了。明天再寫,最近心情不好,換工作挺無奈的。很糾結不知道去哪家好。

收到了中興通訊的offer,不知道到底要不要去。

還收另外兩家公司的offer,一家是做圖形處理使用opencv 和opengl 以及其他的圖形庫,

一家是做c++服務端的開發使用,這個比較符合的我理想中的工作,具體內容是:google規範,list,unordered_map,redis,dump分析方式,STL的bind function,記憶體池和線程池

相關文章

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.