自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(41)
  • 收藏
  • 关注

原创 mysql day12 索引

explain select customer_id from customers where state = 'CA';select count(*) from customers;create index idx_state on customers (state);-- 减少查询次数aexplain select customer_id from customers where points >= 1000;create index idx_points on customers (p

2021-11-14 10:45:39 853

原创 mysql day13 表

create database if not exists sql_store2; -- 如果先前没有才创建use sql_store2;drop table if exists orders; -- 此时可删,重新创建drop table if exists customers; -- 此时不能删除顾客表,因为orders依赖于customers;要删除顾客表,需要先删除订单表,放在上边create table if not exists customers( customer_id in.

2021-11-13 11:32:23 846

原创 mysql day11 第十二章数据类型(部分)

-- 第十二章 数据类型-- 字符串类型-- char 固定长度,州的缩写-- varchar 可变长度,最大是65535 用户名密码-varchar(50);varchar(255)地址-- mediumtext 最大为16mb-- longtext 最大为4GB-- 英文字母1B,中文3B-- bool类型-- boolean-- 枚举类型和集合-- json类型,可存储多个健值对alter-- update products-- set properties = '-- {

2021-11-12 09:49:53 90

原创 mysql day10 第十一章事务

-- 第十一章 事务-- use sql_store;-- start transaction;-- insert into orders(customer_id,order_date,status)-- values(1,'2019-01-01',1);-- insert into order_items-- values(last_insert_id(),1,1,1);-- -- last_insert_id()会返回最新插入订单的id-- commit; -- 事务结

2021-11-11 12:39:39 532

原创 mysql day9 第十章 事件

-- 第十章 触发器-- delimiter $$-- create trigger payments_after_insert -- 表名_after/before_insert/delete/update-- after insert on payments -- insert/delete/update-- for each row -- 每行都会触发-- -- 可以修改任何表中的数据,除了这个触发器所在表-- begin-- -- 触发的主体部分-- up

2021-11-10 13:16:32 537

原创 mysql day8 第九章 存储过程

-- 第九章 存储过程-- 存储过程中的每条语句都要用分号终止,改动默认分隔符-- delimiter $$-- create procedure get_clients()-- begin -- select * from clients;-- end$$-- delimiter ;-- call get_clients() -- 返回数据库中的所有客户delimiter $$create procedure get_invoice_with_balance()begin s

2021-11-09 16:52:13 395

原创 mysql day7 第八章 创建视图

-- 第八章 1-创建视图-- 视图不存储数据,数据存在表中-- use sql_invoicing;-- create view sales_by_client as-- select-- c.client_id,-- c.name,-- sum(invoice_total) as total_sale-- from clients c-- join invoices i using (client_id)-- group by client_id,name-- 习题

2021-11-07 11:27:33 93

原创 mysql day6 第七章数值函数

-- 第七章 数值函数-- select round(5.7345,2); -- 5.73-- select truncate(5.7345,3); -- 5.734 截断,只保留前三位-- select ceiling(5.7); -- 6 ,5.2也得6 返回大于或等于这个数字的最小整数-- select floor(5.2); -- 5 返回小于或等于这个数字的最大整数-- select abs(-5.2); -- 5.2 绝对值-- select rand(); -- 0-1之间的随机值

2021-11-07 11:25:26 73

原创 mysql day5 编写复杂查询

-- select *-- from products-- where unit_price > ( -- select unit_price -- from products -- where product_id = 3)-- 习题 在平均收入以伤害-- use sql_hr;-- select *-- from employees-- where salary > (-- select AVG(salary)-- from employees--

2021-11-06 11:58:19 82

原创 mysql day4

– 聚合函数,只运行非空树枝– 汇总数据– MAX()– MIN()– AVG()– SUM()– COUNT()– count(invoice_total) as number_of_invoices,-- 返回非空– count(payment_date) as count_of_payments,– select– max(invoice_total) as highest,– min(invoice_total) as lowest,–

2021-11-05 16:45:46 91

原创 mysql day3

– 插入– default:系统自动生成唯一值,第一列为主键不需要增加,系统自动递增,直接从第二列开始– insert into customers– values (– default,– ‘John’,– ‘Smith’,– ‘1990-01-01’, – null,这行可空– null, – default 与 null结果相同– ‘address’,– ‘city’,– ‘CA’,– default)–

2021-11-05 16:44:33 74

原创 mysql day2

– 自链接– use sql_hr;– select e.employee_id, e.first_name, m.first_name as manager– 得出每个员工的编号姓名和对应管理者的姓名– from employees e– join employees m– on e.reports_to = m.employee_id– 多表链接– use sql_store;– select– o.order_id, – 订单id– o.order_date,

2021-11-02 13:07:34 81

原创 mysqlworkbench day1

USE sql_store; //只查询一个文件下的表或者双击选择数据库,不然没显示SELECT *//返回所有列FROM customers//查询的是文件下customers的表的所有列,可以直接接到select后– WHERE customer_id = 1//查询id为1的顾客,只显示一条记录– ORDER BY first_name//按照firstname排序SELECTlast_name,first_name,points,(points+10)*100 //注意算数表达式的

2021-11-01 20:06:02 127

原创 堆排序的实现

#include <iostream>using namespace std;#define Max 10void Printarry(int arr[],int len){ for(int i = 0;i<len;i++){ cout<<arr[i]<<" "; } cout<<endl;}void Myswap(int arr[],int a,int b){ int temp = arr[

2021-09-25 20:06:57 46

原创 归并排序的实现

#include <iostream>using namespace std;#define Max 10#include <time.h>#include <sys/timeb.h>int *CreateArray(){//数据放在堆区 srand((unsigned int)time(NULL)); int* arr = (int*) malloc(sizeof (int)*Max); //赋值 for(int i = 0

2021-09-25 19:30:53 44

原创 快速排序的实现

#include <iostream>using namespace std;void PrintArray(int arr[],int len){ for(int i = 0;i<len;i++){ cout<<arr[i]<<" "; } cout<<endl;}void Quicksort(int arr[],int start,int end){ int i = start; in

2021-09-24 21:57:04 61

原创 希尔排序的实现

#include <iostream>#include "time.h"#define Max 10#include <sys/timeb.h>//获得时间long getSystemTime(){ struct timeb tb; ftime(&tb); return tb.time*1000+tb.millitm;}void Swap(int* a,int *b){ int temp = *a; *a = *b;

2021-09-24 20:01:09 49

原创 插入排序的实现

#include <iostream>#include "time.h"#define Max 10#include <sys/timeb.h>//获得时间long getSystemTime(){ struct timeb tb; ftime(&tb); return tb.time*1000+tb.millitm;}void Swap(int* a,int *b){ int temp = *a; *a = *b;

2021-09-23 14:24:56 66

原创 选择排序的实现

#include <iostream>#include "time.h"#define Max 10#include <sys/timeb.h>//获得时间long getSystemTime(){ struct timeb tb; ftime(&tb); return tb.time*1000+tb.millitm;}void Swap(int* a,int *b){ int temp = *a; *a = *b;

2021-09-23 13:57:49 46

原创 冒泡排序的实现

#include <iostream>#include "time.h"#define Max 10#include <sys/timeb.h>//获得时间long getSystemTime(){ struct timeb tb; ftime(&tb); return tb.time*1000+tb.millitm;}void Swap(int* a,int *b){ int temp = *a; *a = *b;

2021-09-23 13:46:15 57

原创 二叉树的创建

//通过中序遍历和先序遍历可以确定一个树//通过中序遍历和后序遍历可以确定一个树//先序和后序不能确定一个树//输入A//A的左子树B//B的左子树C//C的左子树D//D的左子树#为空//D的右子树#为空//C的右子树P//P的左子树为#//P的右子树为#//B的右子树为#//A的右子树为Q//Q的左子树为H//H的左子树为#//H的右子树为#//Q的右子树为#typedef struct BINARYNODE{ char ch; struct

2021-09-23 12:12:24 48

原创 非递归遍历二叉树的实现

#include <iostream>#include "LINKSTACK.h"//二叉树非递归遍历//第一步初始化根结点为False入栈//第二步根结点弹出为False,则左右子树为False入栈(右子树先,根结点变为true后压入栈//第三步根结点弹出(true则不管),左子树弹出为false,则其左右子树入栈(右子树先),重复直至栈中没有元素//为null也压入栈//二叉树的结点typedef struct BINARYNODE{ char ch;

2021-09-23 11:49:04 41

原创 二叉树的实现

#include <iostream>#include <stdlib.h>#include <stdio.h>#include <string.h>//二叉树结点typedef struct BINARYNODE{ char ch; struct BINARYNODE* lchild; struct BINARYNODE* rchild;}Binarynode;//拷贝二叉树Binarynode *Copybina

2021-09-23 10:39:08 66

原创 栈的应用实现

1 就近匹配#include <iostream>#include "LINKSTACK.h"typedef struct MyChar{ Linknode node; char* pAddres; int index;}Mychar;int Isleft(char c){ return c == '(';}int Isright(char c){ return c == ')';}MyChar* Createmychar(cha

2021-09-23 10:36:23 41

原创 顺序队列存储的实现

SEQQueue.h#ifndef UNTITLED5_SEQQUEUE_H#define UNTITLED5_SEQQUEUE_H#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAXSIZE 1024//顺序队列结构体typedef struct SEQQUEUE{ void* data[MAXSIZE]; int size;}Sequeue;

2021-09-20 22:50:07 422

原创 栈的链式存储的实现

LINKSTACK.h#ifndef UNTITLED4_LINKSTACK_H#define UNTITLED4_LINKSTACK_H#include <stdlib.h>#include <stdio.h>#include <string.h>//链式栈的结点typedef struct LINKNODE{ struct LINKNODE* next;}Linknode;//链式栈typedef struct LINKSTACK{

2021-09-20 21:26:01 151

原创 栈的顺序存储的实现

SEQSTACK.h#ifndef UNTITLED3_SEQSTACK_H#define UNTITLED3_SEQSTACK_H#include <stdlib.h>#include <stdio.h>#include <string.h>//数组模拟栈的顺序存储#define MAXSIZE 1024typedef struct SEQSTACK{ void* data[MAXSIZE]; int size;}Seqstack;

2021-09-20 20:43:40 193

原创 单链表实现

LinkList.h#ifndef UNTITLED1_LINKLIST_H#define UNTITLED1_LINKLIST_H#include <stdlib.h>#include <stdio.h>//链表结点typedef struct LINKNODE{ //int data; //写死了只能是int void* data;//可以指向任何类型的数据 struct LINKNODE * next;}LinkNode;//

2021-09-18 20:05:02 49

原创 动态数组的实现

DynamicArray.h#ifndef UNTITLED_DYNAMICARRAY_H#define UNTITLED_DYNAMICARRAY_H//动态增长内存,将存放数据的内存放到堆上//size记录当前数组中具体的元素个数//capacity内存空间一共可以存放多少元素#include <stdio.h>#include <stdlib.h>#include <string.h>//定义动态数组typedef struct Dynami

2021-09-18 17:35:32 143

原创 栈的实现(课

栈的实现node.h#ifndef UNTITLED_NODE_H#define UNTITLED_NODE_Htemplate<class T>struct Node{ T data;//数据域 Node<T> * next;//指针域 Node(){//无参的构造函数 next = NULL; } Node(T item,Node<T> * link=NULL){//已知数据元素值和指针建立结点

2021-09-15 17:24:35 50

原创 计组

第一章第二章第三章第四章

2021-05-13 11:47:08 55

原创 计网

![在这里插

2021-05-13 11:38:34 58

原创 C队列的链式存储

#include <stdio.h>#include <string.h>#include <stdlib.h>//队列不提供遍历功能,只有队头和队尾能够被外界访问//头结点端做队头和队尾都行struct Person{ void * node; char name[64]; int age;};//结点结构体struct QueueNode{ struct QueueNode * next;};//队列结构.

2021-03-21 20:24:27 37

原创 C队列的顺序存储

#include <stdlib.h>#include <string.h>#include <stdio.h>#define MAX 1024typedef void* seqQueue;struct Person{ char name[40]; int age;}void test1(){ //初始化队列 seqQueue myQueue = intt_SeqQueue(); //准备数据

2021-03-21 19:40:17 62

原创 C栈的链式存储接口实现

#include <stdlib.h>//节点结构体struct stackNode{ struct stackNode *next;};//栈的结构体struct LStack{ struct stackNode * pHeader; int m_size;};typedef void* LinkStack;//初始化LinkStack intt_LinkStack(){ struct LStack * myStack = mall

2021-03-21 18:50:07 42

原创 C栈的顺序存储 接口实现

#define MAX 1024#include <stdlib.h>#include <string.h>#include <stdio.h>struct SStack{ void * data[MAX];//栈的数组 int m_Size;//栈大小};typedef void* SeqStack;//初始化栈SeqStack intt_SeqStack(){ struct SStack *myStack = malloc

2021-03-21 18:17:55 56

原创 C双向链表代码

1List.c// List.c// 双向链表//// Created by qshushur on 2021/3/18.//#include <stdio.h>#include "List.h"//初始化链表//Test1只是将结点指针的值传过去 初始化phead中的值不会影响到外边 所以必须传二级指针//使用二级指针传的是phead的地址 *pphead拿到的就是phead/*void ListInit(ListNode** pphead){ *pphe

2021-03-20 15:08:41 65

原创 C链表part3

1题目思路实现ListNode* lesshead, *lesstail; ListNode* greaterhead, *greatertail; lesshead = lesstail = (ListNode*)malloc(sizeof(ListNode)); greaterhead = greatertail = (ListNode*)malloc(sizeof(ListNode)); lesshead->next =

2021-03-20 15:02:37 65

原创 C单链表part2

1题目思路实现int** generateMatrix(int n, int* returnSize, int** returnColumnSizes){ /* 返回数组的行数,为n */ *returnSize = n; /* 返回数组中每行的列数,均为n */ *returnColumnSizes = (int*)malloc(sizeof(int) * n); /* 定义返回数组 */ int** matrix = (int**)malloc

2021-03-20 12:03:34 39

原创 C单链表代码

main.c#include <stdio.h>#include "SList.h"#include <stdlib.h>void TestSList(){ SListNode* pList = NULL; SListPushBack(&pList, 1);//plist传的是值不是地址 进入phead后phead改变不会影响plist 所以采用二级指针的解引用 //解引用二级指针拿到的是一级指针的值,改变一级指针得传二级指针的地址,所以都

2021-03-16 18:58:51 70

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除