04 2022 档案

摘要:#include <stdio.h> enum Sex{ MALE, FEMALE, SECRET}; enum Color{ RED, YELLOW, BLUE};int main(void){ enum Sex s = MALE; return 0;} 联合公用体 阅读全文
posted @ 2022-04-29 18:41 藏进夜里躲在光下 阅读(14) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> struct S{int a : 2; //a 只需要2个比特位int b : 5; // b 只需要5个比特位int c : 10;int d : 30; };int main(void){struct S s;printf("%d\n", sizeof(s) 阅读全文
posted @ 2022-04-29 17:50 藏进夜里躲在光下 阅读(29) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h>struct S1{ char c1; int a; char c2;}; struct S2{ char c1; char c2; int a;}; struct S3 { double b;char c1;int a;}; struct S4 { double 阅读全文
posted @ 2022-04-29 13:23 藏进夜里躲在光下 阅读(27) 评论(0) 推荐(0) 编辑
摘要:delimiter $$create procedure proc_12(in score int)begin if score <60thenselect '不及格';elseif score>=60 and score <=80thenselect '及格';elseselect '输入有误'; 阅读全文
posted @ 2022-04-27 17:09 藏进夜里躲在光下 阅读(20) 评论(0) 推荐(0) 编辑
摘要:delimiter &&create procedure proc06(in empno int )beginselect * from emp where emp.empno=empno;end &&delimiter ;call proc06(1001); -- 封装有参数的存储过程,可以通过传 阅读全文
posted @ 2022-04-27 15:05 藏进夜里躲在光下 阅读(210) 评论(0) 推荐(0) 编辑
摘要:-- 函数的封装delimiter $$create procedure proc01()begin select empno,ename from emp;end $$delimiter ;-- 调用call proc01();delimiter &&create procedure prooc0 阅读全文
posted @ 2022-04-27 12:05 藏进夜里躲在光下 阅读(32) 评论(0) 推荐(0) 编辑
摘要:-- 视图-- 准备数据create database if not exists mydb6_view;use mydb6_view;create table dept( deptno int primary key, dname varchar(20), loc varchar(20));ins 阅读全文
posted @ 2022-04-26 21:53 藏进夜里躲在光下 阅读(96) 评论(0) 推荐(0) 编辑
摘要:用途:cume_dist 分组内小于,等于当前rank值的行数/分组内总行数🍎 应用场景⌚:查询小于等于当前薪资的比例 代码🔔: 运行结果🔢: 辟如第一行的由来0.25 不加patrtition by 则是整个数据为一组,3000,2000,3000有三个 3/12=1/4=0.25 0。16 阅读全文
posted @ 2022-04-26 13:51 藏进夜里躲在光下 阅读(32) 评论(0) 推荐(0) 编辑
摘要:select * ,sum(salary) over(partition by dname order by hiredate) from employee;可以用于求公司的开支 select * ,sum(salary) over(partition by dname order by hired 阅读全文
posted @ 2022-04-25 19:38 藏进夜里躲在光下 阅读(65) 评论(0) 推荐(0) 编辑
摘要:格式: row_number() | rank() | dense_rank() over { partition by ... order by ... } //itheima数据库的employee表 select dname , ename, salary, row_rank() over ( 阅读全文
posted @ 2022-04-25 19:13 藏进夜里躲在光下 阅读(33) 评论(0) 推荐(0) 编辑
摘要:select *,if(socre >=85,'优秀','及格') flag from score; select ifnull(5,0); //如果是5则返回5 是NULL则返回0 1.select case 5 when 1 then '你好' when 2 then 'hello' when 阅读全文
posted @ 2022-04-25 18:34 藏进夜里躲在光下 阅读(19) 评论(0) 推荐(0) 编辑
摘要:1.strlen字符串求长度//遇到\0停止int len=strlen("abcdef");printf("%d\n,len); char arr[]={'a','b','c','d'};int len = strlen(arr); //随机值 遇到f后面的\0停止 1.1如果要自己写一个strl 阅读全文
posted @ 2022-04-24 19:14 藏进夜里躲在光下 阅读(34) 评论(0) 推荐(0) 编辑
摘要://判断一个字符串是否是逆序得来//在str1字符串后在添加一个str1,这样反转的字符串都可以在增加后的字符串找到abcdefabcdef、 #include <stdio.h>#include <string.h>#pragma warning(disable:4996) int is_left 阅读全文
posted @ 2022-04-18 18:51 藏进夜里躲在光下 阅读(63) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> int FindNum(int arr[3][3], int k, int row, int col){ int x = 0; int y = col - 1; while (x <= col - 1 &&y >= 0) { if (arr[x][y]>k) / 阅读全文
posted @ 2022-04-18 16:00 藏进夜里躲在光下 阅读(38) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示