• [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);
    ---------------------------------------------------------------------------------
    

  • 相关阅读:
    构造函数+this关键字+super关键字
    封装
    数组+方法
    流程控制语句
    java运算符+引用数据类型
    java的基础安装
    mysql数据库连接
    mysql数据库约束
    mysql数据库
    练习010:按奇偶排序数组
  • 原文地址:https://www.cnblogs.com/robbychan/p/3786877.html
Copyright © 2020-2023  润新知