文章分类 -  SQL语言

摘要:在 SQL 中,DROP TABLE 和 DELETE 是两种完全不同的操作,主要区别在于操作对象、作用范围和执行结果: 1. DROP TABLE 作用 删除整个表(表结构 + 数据 + 相关对象) 会永久删除表的定义(列名、数据类型、约束、索引、触发器等)和所有数据。 语法 DROP TABLE 阅读全文
posted @ 2025-02-24 11:50 中仕 阅读(152) 评论(0) 推荐(0)
摘要:一、drop table和truncate table 1、drop和truncate都是DDL语言; 2、drop table是删除表,包括表的结构,数据,索引等所有信息; 3、TRUNCATE TABLE 仅仅删除表的所有记录,表的结构、索引、触发器、约束等将被保留,后续仍然可以使用该表; 二、 阅读全文
posted @ 2024-03-14 11:41 中仕 阅读(737) 评论(0) 推荐(0)
摘要:一、复制表结构及数据 首先查看原表的创建语句 (root@localhost) [dbt3]> show create table nation; + + | Table | Create + + nation | CREATE TABLE `nation` ( `n_nationkey` int( 阅读全文
posted @ 2024-01-26 14:30 中仕 阅读(27) 评论(0) 推荐(0)
摘要:一、Stored Objects https://dev.mysql.com/doc/refman/5.7/en/stored-objects.html https://zhuanlan.zhihu.com/p/53401942 This chapter discusses stored datab 阅读全文
posted @ 2024-01-25 14:30 中仕 阅读(35) 评论(0) 推荐(0)
摘要:一、创建函数的时候报错信息 [Err] 1418 - This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *m 阅读全文
posted @ 2024-01-25 08:57 中仕 阅读(27) 评论(0) 推荐(0)
摘要:一、分区表 1.1、分区的类型 1.2、分区表的原数据 (root@localhost) [dbt3]> use information_schema; Reading table information for completion of table and column names You ca 阅读全文
posted @ 2024-01-23 11:34 中仕 阅读(28) 评论(0) 推荐(0)
摘要:一、下载 https://dev.mysql.com/doc/index-other.html 登陆MySQL数据库官网,下载测试库 下载地址:https://github.com/datacharmer/test_db 二、上传解压 [root@mysql soft]# unzip test_db 阅读全文
posted @ 2024-01-17 11:25 中仕 阅读(66) 评论(0) 推荐(0)
摘要:一、导入实验数据 创建数据库 root@localhost) [mysql]> create database dbt3; Query OK, 1 row affected (0.10 sec) 到时sql文件 [root@mysql init.d]# mysql -uroot -p dbt3 </ 阅读全文
posted @ 2024-01-17 08:46 中仕 阅读(32) 评论(0) 推荐(0)
摘要:一、什么是SQL SQL是Structure Query Language(结构化查询语言)的缩写; 二、SQL语句的分类 DDL(Data Definition Languages)数据定义语言(create、drop、alter、rename、truncate); DML(Data Manipu 阅读全文
posted @ 2023-12-25 18:40 中仕
摘要:学习课程:姚远老师 https://www.bilibili.com/video/BV1B34y1R7S8?spm_id_from=333.999.0.0 SQL是Structured Query Language的缩写; 1. 创建部门表 mysql> create table dept(detp 阅读全文
posted @ 2022-05-05 13:54 中仕 阅读(11) 评论(0) 推荐(0)