当前位置:网站首页>数据库常遇到的问题
数据库常遇到的问题
2022-07-16 20:06:00 【星与梦想star_dream】
目录
问题2:Duplicate entry 't07027' for key 'teacher.PRIMARY'
问题1:ambiguous
Column 'S_no' in where clause is ambiguous
解决办法:
WHERE student.S_no 在属性前加上表名即可解决!
问题2:Duplicate entry 't07027' for key 'teacher.PRIMARY'
在建立视图的时候,试图添加新的信息,报错!
Duplicate entry 't07027' for key 'teacher.PRIMARY'
解决办法:
删除原有的视图,并重新建立一个新的视图。
知识点补充:视图是一个虚拟表,是从数据库中一个或多个表中导出来的表
我们来看一下v_teach视图是怎样创建的:
CREATE VIEW v_teach AS SELECT t_no,T_name,major,prof,Department FROM teacher WHERE t_no = 1;在上面创建视图的SQL语句中我们明显看到where t_no = 1;因为视图是查询语句的一个结果集,所以我们要将这个视图删除掉,重新创建一个同名(v_teach)的视图。
更改视图如下:
CREATE VIEW v_teach AS SELECT t_no,T_name,major,prof,Department FROM teacher WHERE Department = '计算机学院';现在继续执行上面代码
INSERT INTO v_teach VALUES('t07027','谢天','教育学','副教授','计算机学院');成功解决!
拓展:在视图中,我们可以看到已经插入了一条信息,回到真实创建的表(teacher)中,我们同样也可以看到该条信息也被插入进去了。
问题3:mysqldump命令备份问题
使用的SQL语句
mysqldump -u root -p _xscj > D:\学习\备份
解决办法:
输入正确的SQL语句:
mysqldump -u root -p _xscj > D:\学习\备份\test.sql注意:一定要加上以.sql后缀,否则会拒绝访问!
![]()
成功解决!
边栏推荐
- new操作符具体做了什么,面试
- What about the update error of win11 preview? Solutions to the failure of win11 preview installation
- (manual) [sqli-labs58-61] limit the injection times: error injection, get injection, character / number type
- Network basic VLAN configuration (ENSP, Cisco)
- Leetcode 1309. Decode letter to integer mapping (yes, once)
- 你的接口多少QPS?
- [UCOS III source code analysis] - Software Timer
- ArrayList源码解析
- My creation anniversary
- Which is a good noise reduction Bluetooth headset? Bluetooth headset noise reduction recommendations
猜你喜欢

KDD 2017 | metapath2vec: scalable representation learning of heterogeneous graphs

快速解决MySQL插入中文数据时报错或乱码问题

Towhee 每日模型周报

How does MySQL execute SQL statements

你的接口多少QPS?

Visual studio production environment configuration scheme: slowcheetah

The real working state of the 21st graduates within one year after graduation

MySQL 5.7.37 database download and installation tutorial (no installation required for Windows)

What did the new operator do? Interview

C language - array
随机推荐
狂神redis笔记01
[UCOS III source code analysis] - time slice rotation
Interviewer: what is the builder model?
【部署】Redis
迪奥疑似抄袭中国马面裙,国内官网已下架该产品
栓Q了,大厂被强制毕业,空窗一个月死背八股文,还好拿到了Offer
信息系统项目管理师必背核心考点(四十四)规划风险应对
A New Optimizer Using Particle Swarm Theory
What is the future of digital employees? Review the application cases of RPA in eight industries
技术干货| MindSpore新一代自主研发分子模拟库:Mind-Sponge
Information system project manager must recite the core examination site (44) planning risk response
华为od-寻找相同子串
Why is the count () method of MySQL so slow?
活动回顾 | 与MindSpore深度畅聊:开源如何探索AI领域全场景
uniapp基础知识
Visual Studio 生产环境配置方案:SlowCheetah
你的接口多少QPS?
Rewrite equals why rewrite hashcode
Technology dry goods | mindspire new generation self-developed molecular simulation library: mind sponge
语音转换主要涉及技术记录






