mysql 學習心得

來源:互聯網
上載者:User

mysql \.        執行指令檔    mysql> \. C:\\mydata.sql

向上鍵 能輸入以前輸入過的文字

--為注釋

 show create table article;    看 article表的結構

article | CREATE TABLE `article` ( `id` int(11) NOT NULL AUTO_INCREMENT, `pid` int(11) DEFAULT NULL, `rootid` int(11) DEFAULT NULL `title` varchar(255) DEFAULT NULL, `cont` text, `pdate` datetime DEFAULT NULL, `isleaf` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=gb2312 |

show databases;    看有多少資料庫

show tables;     看有多少表

desc dept(表名);     看錶的結構

insert into dept values(10,'A','A');

commit

資料庫區別:    資料類型(數值,文本,日期,二進位對象)
        分頁程式(一頁顯示三條),
        自動遞增欄位

分頁    select * from dept order by deptno  desc limit 3, 3;(從第三條

向後數兩條)

> create table article
> (
> id int primary key auto_increment,
> tiele varchar (255)
> );        自動遞增

 select now();  取目前時間

 select date_format(now(),'%Y-%m-%d %h-%i-%s');
select date_format(now(),'%Y-%m-%d %s-%i-%h');
 select date_format(now(),'%Y-%m-%d %h-%i-%h');

insert into emp values (9999,'test','clerk',7369,'1981-12-1

12:10:10', 8000,20,10);

create table emp(empno int primary key, ename varchar(10),job varchar(10),mgr int,hiredate datetime,sal double,comm double,deptno int,foreign key(deptno) references dept(deptno)); create table dept ( deptno int primary key, dname varchar(14), loc varchar(13) );

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.