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 ————————— ...
随机推荐
- python学习笔记(5)—— tuple 本质探究
>>> t=(1,2,3,['a','b','c'],4,5) >>> t[3][0]='x' >>> t (1, 2, 3, ['x', 'b' ...
- Flask框架 之abort、自定义错误、视图函数返回值与jsonify
一.abort函数 使用abort函数可以立即终止视图函数的执行,并可以返回给前端特定的值. abort函数的作用: 1.传递状态码,必须是标准的http状态码 2.传递响应体信息 @app.rout ...
- map 用法
map 是一种关联容器, 提供一对一的关联, 关联的形式为: KEY----VALUE 关键字不重复.multimap与map类似,但是允许关键字重复 即:关键字和与之对应的值 关键字起到索 ...
- 19MVC设计模式
MVC设计模式 MVC英文即Model-View-Controller, 即把一个应用的输入.处理.输出流程按照Model.View.Controller的方式进行分离,这样一个应用被分成三个层——模 ...
- 我的ACM技能框架(自用)
每次接触到新的知识就把它名字记下来,留给以后当纪念 2018.11 已经学会的 滚动数组,前缀和优化 对多维数组在空间复杂度上的降维优化 最长上升子序列 LIS问题,动态规划递推解决 最长不下 ...
- 60.通过应用层join实现用户与博客的关联
在构造数据模型的时候,将有关联关系的数据分割为不同的实体,类似于关系型数据库中的模型. 案例背景:博客网站,一个网站可能有多个用户,一个用户会发多篇博客,此时最好的方式是建立users和blogs两个 ...
- js之字典操作
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- UVA - 10825 Anagram and Multiplication
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=34594 有一个m位n进制的数,它的特性是这个数依次乘以2,3... ...
- PAT 1146 Topological Order
This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topol ...
- Spring MVC学习总结(10)——Spring MVC使用Cors跨域
跨站 HTTP 请求(Cross-site HTTP request)是指发起请求的资源所在域不同于该请求所指向资源所在的域的 HTTP 请求.比如说,域名A(http://domaina.examp ...