MySQL
文章平均质量分 53
Eshel_
这个作者很懒,什么都没留下…
展开
-
数据库day06
1. 将数据写入excel文件中import openpyxlimport pymysqlfrom openpyxl.cell import Cellfrom openpyxl.styles import Alignment, Fontfrom pymysql.cursors import Cursor# 将数据写入excel文件中"""工资簿 - workbook - 一个excel文件工作表 - sheet单元格 - cell - 行和列交汇的位置,保存数据"""wb原创 2022-05-29 19:56:54 · 180 阅读 · 0 评论 -
数据库day05
1. 连接MySQL数据库插入数据经验:一定不能够使用字符串拼接或者格式化等方式组装动态的SQL,否则就会直面SQL注射攻击。import pymysqlfrom pymysql.cursors import Cursorno = int(input('编号: '))name = input('名称: ')location = input('所在地: ')# 1. 创建连接对象conn = pymysql.connect(host='localhost', port=3306,原创 2022-05-29 19:48:23 · 168 阅读 · 0 评论 -
数据库day04
-- 如果存在就删除名为hrs的数据库drop database if exists `hrs`;-- 创建名为hrs的数据库并指定默认的字符集create database `hrs` default charset utf8mb4;-- 切换到hrs数据库use `hrs`;-- 创建部门表create table `tb_dept`(`dno` int not null comment '编号',`dname` varchar(10) not null comment '名称原创 2022-05-26 20:55:19 · 281 阅读 · 0 评论 -
数据库day03
1. 查询所有学生的所有信息select * from tb_student;select stu_id, stu_name, stu_sex, stu_birth, stu_addr, col_id from tb_student;2. 查询学生的学号、姓名和籍贯(投影)select stu_id, stu_name, stu_addr from tb_student;3. 查询原创 2022-05-25 20:59:16 · 4714 阅读 · 1 评论 -
数据库day02
1. 删除名为school的数据库drop database if exists `school`;2. 创建名为school的数据库create database `school` default character set utf8mb4;3. 切换到school数据库use `school`;4. 创建学院表create table `tb_college`(`col_id` integer not null auto_increment comment '编号',`col_原创 2022-05-25 20:31:09 · 159 阅读 · 0 评论 -
数据库day01
1. MySQL命令1.1 显示所有的数据库显示所有的数据库:show databases;1.2 显示所有的字符集显示所有的字符集:show character set;1.3 切换数据库切换数据库:use school;1.4 显示所有表显示所有表:show tables;1.5 获取帮助获取帮助:help。2. SQLSQL:Structured Query Language。DDL:Data Definition Language - create / drop / alt原创 2022-05-23 19:33:39 · 159 阅读 · 0 评论