• [Mysql] Learning_Notes for MYSQL


    create database mydata;
    
    use mydata;
    
    create table dept
    (
    deptno int primary key,
    dname varchar(14),
    loc varchar(13)
    );
    
    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)
    );
    ?
    . c:\mysql_script\mydata.sql
    desc dept
    insert into dept values(10, 'A', 'a');
    insert into dept values(20, 'B', 'b');
    insert into dept values(30, 'C', 'c');
    insert into dept values(40, 'D', 'd');
    insert into dept values(50, 'E', 'e');
    commit;
    select * from dept order by deptno desc limit 3, 2;   -- 降序第三行之后,分页
    create table article
    (
    id int primary key auto_increment,  -- 自动递增
    title varchar(255)
    );
    select now();
    select date_format(now(), '%Y-%m-%d %H:%i:%s');
    insert into emp values(9999, 'test', 'clerk', 7369, '1981-12-23 12:23:23', 8000, 80, 10);
    
    -------------------bbs.sql----------------------------------------------------------------------
    create database bbs;
    
    use bbs;
    
    create table article 
    (
    id int primary key auto_increment,
    pid int,
    rootid int,
    title varchar(255),
    cont text,
    pdate datetime,
    isleaf int 
    );
    
    insert into article values (null, 0, 1, '蚂蚁大战大象', '蚂蚁大战大象', now(), 1);
    insert into article values (null, 1, 1, '大象被打趴下了', '大象被打趴下了',now(), 1);
    insert into article values (null, 2, 1, '蚂蚁也不好过','蚂蚁也不好过', now(), 0);
    insert into article values (null, 2, 1, '瞎说', '瞎说', now(), 1);
    insert into article values (null, 4, 1, '没有瞎说', '没有瞎说', now(), 0);
    insert into article values (null, 1, 1, '怎么可能', '怎么可能', now(), 1);
    insert into article values (null, 6, 1, '怎么没有可能', '怎么没有可能', now(), 0);
    insert into article values (null, 6, 1, '可能性是很大的', '可能性是很大的', now(), 0);
    insert into article values (null, 2, 1, '大象进医院了', '大象进医院了', now(), 1);
    insert into article values (null, 9, 1, '护士是蚂蚁', '护士是蚂蚁', now(), 0);
    ---------------------------------------------------------------------------------
    

  • 相关阅读:
    字符串的操作
    10.20 整理1
    if else; while; break;continue ----流程控制系列
    10.19 重新打了第一天的代码(课件))
    10.17
    svn,导入数据到版本库及使用工作副本
    mysql的反引号backtick
    css中的1px并不等于设备的1px
    onclick事件属性与在用js绑定onclick事件中的this的区别
    一次对CI框架update方法底层实现的探索之旅
  • 原文地址:https://www.cnblogs.com/robbychan/p/3786877.html
Copyright © 2020-2023  润新知