
MySQL
尛刀石
这个作者很懒,什么都没留下…
展开
-
MySQL的视图、函数、存储过程、动态执行SQL
1、视图-- 创建视图 crate view v1 as select * from A where id > 1;-- 删除视图 drop view v1;-- 修改视图 alter view v1 as select * from A where id > 2;-- 通过调用视图来查询 select * from v1;-- 说明 当在A表中更新了数据时,视图也会跟着更新数据,反之亦然。2、触发器-- 创建触发器--往A表中添加数据时,同时也会在B表插入对应数据原创 2020-07-14 23:15:00 · 354 阅读 · 0 评论 -
MySQL数据库的增删改查
1、数据库的操作-- 创建数据库-- 使用默认的校对规则就行create database 数据库名 default character set utf8 collate utf8_general_ci;-- 查询所有的数据库show databases;-- 删除数据库drop database 数据库名2、表的操作-- 创建表之前要先进入某个数据库里面use 数据库名;-- 创建表create table 表名( 列名 类型 是否为空, 列名 类型 是否为空, 列名 类型原创 2020-07-12 23:37:25 · 145 阅读 · 0 评论 -
关于MySQL报错 ERROR 1215 (HY000): Cannot add foreign key constraint
@关于MySQL报错 ERROR 1215 (HY000): Cannot add foreign key constraint创建表表一(学生):mysql> create table student( -> sid int auto_increment, -> sname varchar(10) not null, -> gender char(1) not null, -> primary key (sid) -> )原创 2020-06-24 11:34:45 · 7974 阅读 · 1 评论