自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

MySQL數(shù)據(jù)庫的基本知識大全

數(shù)據(jù)庫 MySQL
我們今天只要和大家一起探討的是MySQL數(shù)據(jù)庫的基本知識,當(dāng)然也提議數(shù)據(jù)庫新手來看看此篇文章,相信會有一定的收獲的。

以下的文章主要介紹的是MySQL數(shù)據(jù)庫的基本知識,其中包括對MySQL數(shù)據(jù)庫的創(chuàng)建,以及對一些相關(guān)的數(shù)據(jù)類型描述,其中還涉及到表的創(chuàng)建,以下就是文章的詳細(xì)內(nèi)容描述,望你會有所收獲。

MySQL數(shù)據(jù)庫安裝 ***改變字符集UTF8

創(chuàng)建數(shù)據(jù)庫

  1. create database mydata;  
  2. use mydata; 

數(shù)據(jù)類型 int double char varchar datetime longtext

創(chuàng)建表 create table dept

  1. (  
  2. deptno int primary key,  
  3. dname varchar(14),  
  4. loc varchar(13)  
  5. );  
  6. create table emp  
  7. (  
  8. empno int primary key,  
  9. ename varchar(10),  
  10. job varchar(15),  
  11. mgr int,  
  12. hiredate datetime,  
  13. sal double,  
  14. deptno int,  
  15. foreign key (deptno) references dept(deptno)  
  16. );  

 

MySQL數(shù)據(jù)庫執(zhí)行腳本文件.sql \. 文件路徑 或 source 文件路徑

?

sql文件中 -- 注釋

MySQL管理軟件 MySQL administrator,toad for MySQL

查看數(shù)據(jù)庫 show databases;

查看表 show tables;

查看表結(jié)構(gòu) desc dept;

插入數(shù)據(jù)

  1. intsert into dept values(1,'a','a');  
  2. commit; 

分頁 select * from dept order by deptno desc limit 3,2; (從第三條往后數(shù)兩條)

自增 create table article

  1. (  
  2. id int primary key auto_increment,  
  3. title vachar(255)  
  4. );  
  5. insert into article values(null,'a');  
  6. insert into article(title) values('c'); 

 

日期處理

獲取當(dāng)前日期 select now();

轉(zhuǎn)化字符串 select date_format(now(),'%Y-%m-%d %H:%i:%s');

  1. jdbc連接MySQL  
  2. Connection conn=null;  
  3. Statement stmt=null;   
  4. ResultSet rs=null;   
  5. try{   
  6. Class.forName("com.MySQL.jdbc.Driver").newInstance();  
  7. conn=DriverManager.getConnection("jdbc:MySQL://localhost/test? user=root&password=root");  
  8. stmt=conn.createStatement();  
  9. rs = stamt.executeQuery(sql);  
  10. }  
  11. catch(Exception e){}  
  12. finally{  
  13. try{  
  14. if(rs!=null){rs.close; rs=null;}  
  15. if(stat!=null){stat.close; stat=null;}  
  16. if(conn!=null){conn.close; conn=null;}  
  17. }  
  18. catch(SQLException e){  
  19. e.printStackTrace();  
  20. }  
  21.  

以上的相關(guān)內(nèi)容就是對MySQL數(shù)據(jù)庫知識的介紹,望你能有所收獲。

【編輯推薦】

  1. 支持MySQL數(shù)據(jù)庫,SPL升級到3.2
  2. MySQL添加授權(quán)的用戶命令實際操作
  3. MySQL導(dǎo)入與導(dǎo)出.sql文件實操
  4. asp.net連接MySQL的正確操作流程
  5. MySQL數(shù)據(jù)庫備份基礎(chǔ)知識匯總
責(zé)任編輯:佚名 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2011-03-04 15:30:08

Oracle數(shù)據(jù)庫

2012-03-19 09:24:25

JavaScript

2011-11-23 10:35:53

2011-03-31 14:46:29

MySQL數(shù)據(jù)庫備份

2010-01-25 11:55:41

MySQL數(shù)據(jù)庫備份數(shù)據(jù)庫安全

2010-07-28 15:52:00

Flex

2009-06-11 14:40:32

Java list

2010-05-06 17:41:19

Unix命令

2017-02-20 23:05:14

JavaScript

2017-04-12 11:47:32

2017-10-20 22:40:54

電線電纜導(dǎo)體

2009-06-26 14:42:08

2018-11-27 15:51:10

MySQL數(shù)據(jù)庫查詢優(yōu)化

2009-08-28 16:53:05

C# for語句

2009-12-22 14:43:38

Linux操作系統(tǒng)

2010-01-28 11:18:14

Android界面布局

2010-06-13 13:49:14

2012-06-05 00:41:07

JavaJava內(nèi)存

2010-05-28 14:51:47

MySQL數(shù)據(jù)庫

2010-04-21 18:38:36

Unix網(wǎng)絡(luò)
點贊
收藏

51CTO技術(shù)棧公眾號