day1(2023年3月5日)

本文介绍了如何使用SQL查询information_schema数据库来获取数据库管理系统中的元数据,包括数据库名、表名和列名。例如,查询所有数据库名可以使用`SELECTschema_nameFROMinformation_schema.schemata`,查找特定数据库如security下的表名,以及从users表中提取字段名如username和password。
摘要由CSDN通过智能技术生成

关于数据的查询

information_schema:存放着当前数据库管理系统中所有数据库信息(库名,表名,列名等)的一个数据库

information_schema.schemata:记录所有数据库信息的表

information_schema.tables:记录所有表名信息的表

schema_name:数据库名

table_name : 表名

column_name:列名

show databases;=select schema.name from information_schema.schemata;

查询数据库名

select schema_name from information_schema.schemata;

查询security数据库下的表名(用table_schema)

select table_name from information_schema.tables where table_schema="security"

查询users表下的字段名;

select column_name from information_schema.columns where table_name ="users";

查询username password数据

  1. show databases;(查看数据库)

  1. use security;(进入数据库)

  1. show tables;(查看表格)

select username,password from users;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
以下是Python实现的绘制202369的七段数码管代码: ``` # 导入所需模块 import turtle import time # 定义数码管的绘制函数 def draw_digit(num): # 绘制横线 if num in [2, 3, 4, 5, 6, 8, 9]: turtle.pendown() else: turtle.penup() turtle.fd(40) turtle.right(90) # 绘制左上竖线 if num in [0, 4, 5, 6, 8, 9]: turtle.pendown() else: turtle.penup() turtle.fd(40) turtle.right(90) # 绘制右上竖线 if num in [0, 2, 6, 8]: turtle.pendown() else: turtle.penup() turtle.fd(40) turtle.left(90) # 绘制横线 if num in [0, 1, 3, 4, 7, 8, 9]: turtle.pendown() else: turtle.penup() turtle.fd(40) turtle.left(90) # 绘制右下竖线 if num in [0, 2, 3, 5, 6, 8, 9]: turtle.pendown() else: turtle.penup() turtle.fd(40) turtle.left(90) # 绘制左下竖线 if num in [0, 2, 6, 8]: turtle.pendown() else: turtle.penup() turtle.fd(40) turtle.right(90) # 绘制横线 if num in [0, 1, 2, 3, 4, 7, 8, 9]: turtle.pendown() else: turtle.penup() turtle.fd(40) turtle.right(90) # 返回原点 turtle.penup() turtle.fd(20) turtle.right(90) turtle.fd(140) turtle.left(90) # 定义主函数 def main(): # 获取当前时间 current_time = time.localtime() year = current_time.tm_year month = current_time.tm_mon day = current_time.tm_mday # 转换为需要绘制的期 year = 2023 month = 6 day = 9 # 设置画布大小 turtle.setup(800, 400) # 设置画笔 turtle.penup() turtle.fd(-250) turtle.pensize(5) # 绘制份 draw_digit(year // 1000) draw_digit(year // 100 % 10) draw_digit(year // 10 % 10) draw_digit(year % 10) # 绘制横杠 turtle.penup() turtle.fd(80) turtle.right(90) turtle.fd(40) turtle.left(90) turtle.pendown() turtle.fd(40) turtle.penup() turtle.fd(40) turtle.right(90) turtle.fd(80) turtle.left(90) # 绘制份 draw_digit(month // 10) draw_digit(month % 10) # 绘制横杠 turtle.penup() turtle.fd(80) turtle.right(90) turtle.fd(40) turtle.left(90) turtle.pendown() turtle.fd(40) turtle.penup() turtle.fd(40) turtle.right(90) turtle.fd(80) turtle.left(90) # 绘制期 draw_digit(day // 10) draw_digit(day % 10) # 点击关闭画布 turtle.exitonclick() if __name__ == '__main__': main() ``` 这段代码先获取当前时间,然后将期设为202369。接着使用draw_digit(num)函数绘制份、份、期的七段数码管,同时绘制横杠分隔符。最后点击画布关闭。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值