mysql20170407代码实现
今天用了一会儿sqlyog,感觉还是会让人懒惰,所以选择了ms-dos环境,感觉不错,原生态,敲着很爽;
| test01 |
| tree |
| world |
+--------------------+
18 rows in set (0.00 sec) mysql> create database if not exists myschool;
Query OK, 1 row affected (0.00 sec) mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| bdqn |
| mybatis |
| myschool |
| myschool2 |
| mysql |
| news |
| performance_schema |
| sakila |
| school |
| smbms |
| smbmsdemo |
| ssh01 |
| t09 |
| t12 |
| test |
| test01 |
| tree |
| world |
+--------------------+
19 rows in set (0.00 sec) mysql> create table if not exists `subject`()
->
-> ;
ERROR 1046 (3D000): No database selected
mysql> create table if not exists `subject`(SubjectNo int(11),SubjectName vachar
(50),ClassHour int(4),GradeID int(4))comment='课程数据表';
ERROR 1046 (3D000): No database selected
mysql> use myschool;
Database changed
mysql> create table if not exists `subject`(SubjectNo int(11),SubjectName vachar
(50),ClassHour int(4),GradeID int(4))comment='课程数据表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'vacha
r(50),ClassHour int(4),GradeID int(4))comment='课程数据表'' at line 1
mysql> create table if not exists `subject`(SubjectNo int(11),SubjectName vachar
(50),ClassHour int(4),GradeID int(4))comment='课程数据表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'vacha
r(50),ClassHour int(4),GradeID int(4))comment='课程数据表'' at line 1
mysql> create table if not exists `subject`(SubjectNo int(11),SubjectName varcha
r(50),ClassHour int(4),GradeID int(4))comment='课程数据表';
Query OK, 0 rows affected (2.20 sec) mysql> select * from subject
-> ;
Empty set (0.00 sec) mysql> select * from `subject`;
Empty set (0.00 sec) mysql> insert into `subject` values('','高等数学-1','','');
Query OK, 1 row affected (0.14 sec) mysql> insert into `subject` values('','高等数学-2','','');
Query OK, 1 row affected (0.13 sec) mysql> insert into `subject` values('','高等数学-3','','');
Query OK, 1 row affected (0.13 sec) mysql> insert into `subject` values('','高等数学-4','','');
Query OK, 1 row affected (0.14 sec) mysql> insert into `subject` values('','C语言-1','','');
Query OK, 1 row affected (0.14 sec) mysql> insert into `subject` values('','C语言-2','','');
Query OK, 1 row affected (0.13 sec) mysql> select * from `subject`;
+-----------+-------------+-----------+---------+
| SubjectNo | SubjectName | ClassHour | GradeID |
+-----------+-------------+-----------+---------+
| 1 | 高等数学-1 | 120 | 1 |
| 2 | 高等数学-2 | 110 | 2 |
| 3 | 高等数学-3 | 100 | 3 |
| 4 | 高等数学-4 | 130 | 4 |
| 5 | C语言-1 | 120 | 1 |
| 6 | C语言-2 | 110 | 2 |
+-----------+-------------+-----------+---------+
6 rows in set (0.00 sec) mysql> create table if not exists grade;
ERROR 1113 (42000): A table must have at least 1 column
mysql> create table if not exists grade(GradeID int(11) primary key,GradeName va
rchar(50))comment='年级表';
Query OK, 0 rows affected (2.22 sec) mysql> insert into grade values('','大一');
Query OK, 1 row affected (0.11 sec) mysql> insert into grade values('','大二');
Query OK, 1 row affected (0.13 sec) mysql> insert into grade values('','大三');
Query OK, 1 row affected (0.13 sec) mysql> insert into grade values('','大四');
ERROR 1062 (23000): Duplicate entry '' for key 'PRIMARY'
mysql> insert into grade values('','大四');
Query OK, 1 row affected (0.13 sec) mysql> select * from grade;
+---------+-----------+
| GradeID | GradeName |
+---------+-----------+
| 1 | 大一 |
| 2 | 大二 |
| 3 | 大三 |
| 4 | 大四 |
+---------+-----------+
4 rows in set (0.00 sec) mysql> create table if not exists student(StudentNo int(4) not null comment '学
号'),,,Loginarchar(20) default null,StudentName varchar(20) default null comment
'学ent '学生姓名',,,,,
'> ;
'> ;
'> kdjsf;a
'> ;
'> Bye C:\Users\Administrator>mysql -uroot -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.54-log MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use myschool;
Database changed
mysql> create table if not exists student(StudentNo int(4) not null comment '学
号',LoginPwd varchar(20) default null,StudentName varchar(20) default null comme
nt '学生姓名',Sex tinyint(1) default null comment '性别,取值0或1',GradeId int(1
1) default null comment '年级编号',Phone varchar(50) not null comment '联系电话
,允许为空,即可选输入',Address varchar(255) not null comment '地址,允许为空,
即可选输入',BornDate datetime default null comment '出生时间',Email varchar(50)
not null comment '邮箱账号,允许为空,即可选输入',IdentityCard varchar(18) defau
lt null comment '身份证号')comment='学生类';
Query OK, 0 rows affected (0.53 sec) mysql> select * from student;
Empty set (0.02 sec) mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| bdqn |
| mybatis |
| myschool |
| myschool2 |
| mysql |
| news |
| performance_schema |
| sakila |
| school |
| smbms |
| smbmsdemo |
| ssh01 |
| t09 |
| t12 |
| test |
| test01 |
| tree |
| world |
+--------------------+
19 rows in set (0.00 sec) mysql> use myschool;
Database changed
mysql> select * from student;
Empty set (0.00 sec) mysql> show tables;
+--------------------+
| Tables_in_myschool |
+--------------------+
| grade |
| student |
| subject |
+--------------------+
3 rows in set (0.00 sec) mysql> select * from subject;
+-----------+-------------+-----------+---------+
| SubjectNo | SubjectName | ClassHour | GradeID |
+-----------+-------------+-----------+---------+
| 1 | 高等数学-1 | 120 | 1 |
| 2 | 高等数学-2 | 110 | 2 |
| 3 | 高等数学-3 | 100 | 3 |
| 4 | 高等数学-4 | 130 | 4 |
| 5 | C语言-1 | 120 | 1 |
| 6 | C语言-2 | 110 | 2 |
+-----------+-------------+-----------+---------+
6 rows in set (0.00 sec) mysql> use myschool;
Database changed
mysql> show tables;
+--------------------+
| Tables_in_myschool |
+--------------------+
| grade |
| student |
| subject |
+--------------------+
3 rows in set (0.00 sec) mysql> drop subject if exists;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'subje
ct if exists' at line 1
mysql> drop table subject if exists;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'if ex
ists' at line 1
mysql> drop `subject` if exists;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '`subj
ect` if exists' at line 1
mysql> drop table if exists subject;
Query OK, 0 rows affected (0.47 sec) mysql> show tables;
+--------------------+
| Tables_in_myschool |
+--------------------+
| grade |
| student |
+--------------------+
2 rows in set (0.00 sec) mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(11
) not null comment '课程编号',SubjectName varchar(50) default null comm' at line
1
mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM,comment='课程名称表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(11
) not null comment '课程编号',SubjectName varchar(50) default null comm' at line
1
mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM comment='课程名称表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(11
) not null comment '课程编号',SubjectName varchar(50) default null comm' at line
1
mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM comment='课程名称表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(11
) not null comment '课程编号',SubjectName varchar(50) default null comm' at line
1
mysql> create table if not exists subject(SubjectNo in(0t1) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM comment='课程名称表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(0t
1) not null comment '课程编号',SubjectName varchar(50) default null com' at line
1
mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM,comment='课程名称表'; ;
mysql练习代码
当然ms-dos的缺点也很多:
1 不好编辑,特别是错了的时候,会乱
2 写完保存代码很困难
3 每次语句写完都要打分号
mysql20170407代码实现的更多相关文章
- 日期格式代码出现两次的错误 ORA-01810
错误的原因是使用了两次MM . 一.Oracle中使用to_date()时格式化日期需要注意格式码 如:select to_date('2005-01-01 11:11:21','yyyy-MM-dd ...
- 可爱的豆子——使用Beans思想让Python代码更易维护
title: 可爱的豆子--使用Beans思想让Python代码更易维护 toc: false comments: true date: 2016-06-19 21:43:33 tags: [Pyth ...
- iOS代码规范(OC和Swift)
下面说下iOS的代码规范问题,如果大家觉得还不错,可以直接用到项目中,有不同意见 可以在下面讨论下. 相信很多人工作中最烦的就是代码不规范,命名不规范,曾经见过一个VC里有3个按钮被命名为button ...
- Jquery的点击事件,三句代码完成全选事件
先来看一下Js和Jquery的点击事件 举两个简单的例子 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&q ...
- redux-amrc:用更少的代码发起异步 action
很多人说 Redux 代码多,开发效率低.其实 Redux 是可以灵活使用以及拓展的,经过充分定制的 Redux 其实写不了几行代码.今天先介绍一个很好用的 Redux 拓展-- redux-amrc ...
- 编写高质量代码:改善Java程序的151个建议(第5章:数组和集合___建议75~78)
建议75:集合中的元素必须做到compareTo和equals同步 实现了Comparable接口的元素就可以排序,compareTo方法是Comparable接口要求必须实现的,它与equals方法 ...
- 使用 .NET WinForm 开发所见即所得的 IDE 开发环境,实现不写代码直接生成应用程序
直接切入正题,这是我09年到11年左右业余时间编写的项目,最初的想法很简单,做一个能拖拖拽拽就直接生成应用程序的工具,不用写代码,把能想到的业务操作全部封装起来,通过配置的方式把这些业务操作组织起来运 ...
- jsp前端实现分页代码
前端需要订一page类包装,其参数为 private Integer pageSize=10; //每页记录条数=10 private Integer totalCount; //总记录条数 priv ...
- 【开源】简单4步搞定QQ登录,无需什么代码功底【无语言界限】
说17号发超简单的教程就17号,qq核审通过后就封装了这个,现在放出来~~ 这个是我封装的一个开源项目:https://github.com/dunitian/LoTQQLogin ————————— ...
随机推荐
- UI设计四要素
信息.样式.布局.交互. +层次: UI所有的工作都可以从这几个方面入手.
- Call stack Structure
The stack frame at the top of the stack is for the currently executing routine. Th ...
- 梦想CAD控件网页版扩展数据
随着基于CAD的应用软件飞速发展,经常需要保存一些与图形可视性无关的数据,即非图形参数.例如在绘制化验样图中包含品位数据.MxCAD定义一类新的参数——实体扩展数据.扩展数据与实体的可视性无关,而是用 ...
- JAVA程序员面试笔试宝典3
1.什么是线程?它与进程有什么区别?为什么要使用多线程 线程是指程序在执行过程中,能够执行程序代码的一个执行单元.进程是指一段正在执行的程序. 使用多线程可以减少程序的相应时间 与进程相比,线程的创建 ...
- gym101343J. Husam and the Broken Present 2 (状压DP)
题意:给定n个串 每个串长度不超过100 找到一个新串 使得这n个串都是它的字串 输出这个新串的最小长度 题解:n是15 n的阶乘的复杂度肯定不行 就想到了2的15次方的复杂度 想到了状压但是不知道怎 ...
- UVA - 1615 Highway(贪心-区间选点问题)
题目: 给定平面上n(n≤105)个点和一个值D,要求在x轴上选出尽量少的点,使得对于给定的每个点,都有一个选出的点离它的欧几里得距离不超过D. 思路: 先自己造区间,然后贪心选点就可以了.之前做过一 ...
- Python面向对象一些阶段性总结
什么时候用面向对象??? 1.共同的方法,提出来.共同的方法可以产生一个连接,其他方法可以使用,例如传文件,和执行命令都需要建立连接,关闭连接 例如 获取连接,...操作..关闭连接 2.创建模板.造 ...
- python3中整数和小数的转换
在整数除法中,除法(/)总是返回一个浮点数,如果只想得到整数的结果,丢弃可能的分数部分,可以使用运算符 // : >>> 17 / 3 # 整数除法返回浮点型 5.666666666 ...
- [bzoj3209][花神的数论题] (数位dp+费马小定理)
Description 背景众所周知,花神多年来凭借无边的神力狂虐各大 OJ.OI.CF.TC …… 当然也包括 CH 啦.描述话说花神这天又来讲课了.课后照例有超级难的神题啦…… 我等蒟蒻又遭殃了. ...
- Spring核心技术(四)——Spring的依赖及其注入(续二)
前面两篇文章描述了IoC容器中依赖的概念,包括依赖注入以及注入细节配置.本文将继续描述玩全部的依赖信息. 使用 depends-on 如果一个Bean是另一个Bean的依赖的话,通常来说这个Bean也 ...