zoukankan      html  css  js  c++  java
  • mysql常用语句1

    很多mysql语句用的时候想不起来,现在用个简单的例子记着。

    /*
    SQLyog Ultimate v11.33 (64 bit)
    MySQL - 5.1.49-community : Database - db_book
    *********************************************************************
    */


    /*!40101 SET NAMES utf8 */;

    /*!40101 SET SQL_MODE=''*/;

    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
    CREATE DATABASE /*!32312 IF NOT EXISTS*/`db_book` /*!40100 DEFAULT CHARACTER SET utf8 */;

    USE `db_book`;

    /*Table structure for table `t_book` */

    DROP TABLE IF EXISTS `t_book`;

    CREATE TABLE `t_book` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `bookName` varchar(20) DEFAULT NULL,
    `author` varchar(20) DEFAULT NULL,
    `sex` varchar(10) DEFAULT NULL,
    `price` float DEFAULT NULL,
    `bookDesc` varchar(1000) DEFAULT NULL,
    `bookTypeId` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `FK_t_book` (`bookTypeId`),
    CONSTRAINT `FK_t_book` FOREIGN KEY (`bookTypeId`) REFERENCES `t_booktype` (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

    /*Data for the table `t_book` */

    insert into `t_book`(`id`,`bookName`,`author`,`sex`,`price`,`bookDesc`,`bookTypeId`) values (2,'Java编程思想1','JJ1','女',111,'这个一本好书籍1',1),(3,'美女的生活1','呵呵2','女',121,'11112',2),(4,'java代码','风格','女',120,'是',1),(6,'java编程思想','美女','女',100,'搜索',2);

    /*Table structure for table `t_booktype` */

    DROP TABLE IF EXISTS `t_booktype`;

    CREATE TABLE `t_booktype` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `bookTypeName` varchar(20) DEFAULT NULL,
    `bookTypeDesc` varchar(1000) DEFAULT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

    /*Data for the table `t_booktype` */

    insert into `t_booktype`(`id`,`bookTypeName`,`bookTypeDesc`) values (1,'计算机类2','计算机类书籍3'),(2,'建筑类2','建筑类图书2'),(3,'计算机科学2','2');

    /*Table structure for table `t_user` */

    DROP TABLE IF EXISTS `t_user`;

    CREATE TABLE `t_user` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `userName` varchar(20) DEFAULT NULL,
    `password` varchar(20) DEFAULT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

    /*Data for the table `t_user` */

    insert into `t_user`(`id`,`userName`,`password`) values (1,'java1234','123456');

    /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
    /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
    /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
    /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

  • 相关阅读:
    Win8常用快捷键
    清除远程桌面连接记录
    通过注册表改变“我的文档”等的默认位置,防止系统重装造成数据丢失
    HTML 转义字符对照表
    r语言 函数
    sparkr——报错
    R语言--saprkR基本使用
    r绘图基本
    R绘制中国地图,并展示流行病学数据
    r画饼图
  • 原文地址:https://www.cnblogs.com/catcoding/p/4830473.html
Copyright © 2011-2022 走看看