- 博客(218)
- 收藏
- 关注
原创 SQL MySQL SQL Server 索引(index)
-- 创建表CREATE TABLE t51( emp_id int IDENTITY(1,1), emp_name VARCHAR(50) NOT NULL DEFAULT '', emp_age SMALLINT NOT NULl DEFAULT 0, emp_address VARCHAR(100) NOT NULL DEFAULT '', phone char(11) NOT NULL DEFAUlT '')-- 添加数据INSERT INTO t51(emp_name, emp
2021-05-09 22:52:21
429
原创 SQL MySQL SQL Server 分页查询
mysql-- 从第1行开始,查询3个数据 => 也就是每页3条信息,查询第1页的信息SELECT * FROM emp ORDER BY empno LIMIT 0, 3-- 从第4行开始,查询3个数据 => 也就是每页3条信息,查询第2页的信息SELECT * FROM emp ORDER BY empno LIMIT 3, 3-- 公式-- LIMIT 每页显示记录数 * (第几页-1), 每页显示记录数-- 从第1行开始,查询5个数据 => 也就是每页5条信息,查
2021-05-09 16:29:08
187
原创 SQL MySQL SQL Server 合并查询(union) 复合主键 唯一约束(UNIQUE) 外键 CHECK约束
外键-------------------------------foreign key-----------------------------/*foreign key(外键)用于定义主表和从表之间的关系;外键约束要定义在从表上,主表则必须具有主键约束或是UNIQUE约束,要求外键列数据必须在主表的主键列存在或者为null1.存储引擎必须是innodb,这样的表才支持外键2.外键字段类型要和那个表的主键字段类型一致(长度可以不一样)FOREIGN KEY(本表字段名) REFERE
2021-05-09 16:04:21
1675
2
原创 SQL MySQL SQL Server 数据加密
SQL Server--MD5加密--HashBytes ('加密方式', '待加密的值')--加密方式= MD2 | MD4 | MD5 | SHA | SHA1 --返回值类型:varbinary(maximum 8000 bytes)select HashBytes('MD5','123456')--HashBytes生成的结果为:0xE10ADC3949BA59ABBE56E057F20F883E--一般工具生成的都是没有0x和是小写的,16进制的数值,去掉“0x”转换为小写值
2021-05-08 16:17:02
558
原创 SQL MySQL SQL Server 时间函数
MySQL-- 创建表CREATE table mes( id int, content varchar(30), send_time datetime)-- 添加数据 CURRENT_TIMESTAMP 和 now()效果一样insert into mes values(1, '北京新闻', CURRENT_TIMESTAMP); insert into mes values(1, '北京新闻', now()); SELECT * FROM mes;-- 查询send_time
2021-05-08 14:37:55
393
原创 SQL MySQL SQL Server 修改(更新)表
添加列(column)MySQL 和 SQL Server 通用向emp数据库添加images列ALTER TABLE emp ADD VARCHAR(200) NOT NULL DEFAULT ''删除列(column)MySQL删除emp表的sex列ALTER TABLE emp DROP sex;SQL Server如果列有约束,要先删除约束(SQL Server列的默认值有默认值约束)删除emp表的sex列ALTER TABLE emp DROP COLUMN sex;
2021-05-06 17:05:14
319
原创 SQL MySQL SQL Server 主键自动递增 和 自动类型转换
insert在调用insert语句插入数据时,涉及到了自动类型转换# 创建CREATE TABLE t7(id INT PRIMARY key IDENTITY(1,1),name VARCHAR(50),age INT)# 插入# 正确 标准方式INSERT INTO t7 VALUES('测试', 20);# 正确 10 数字转文本INSERT INTO t7 VALUES(10, 20)# 正确 20 文本转数字INSERT INTO t7 VALUES('测试', '20
2021-05-04 21:00:39
419
原创 SQL MySQL SQL Server 数据库的列类型
数值类型整数类型大小(字节)tinyint1smallint2mediumint3int4bigint8比bigint更大的整数类型decimal(M,0)小数类型类型大小(字节)备注float4double8SQL SERVER 没有此数据类型decimal[M,D]大小不确定M长度,D精确到多少位文本(字符串)类型类型表示范围备注char0 ~255
2021-05-04 17:18:15
1094
原创 mysql 安装mysql8.0版本
访问 MySql下载官网 https://www.mysql.com/downloads/点击网页底部的 MySQL Community (GPL) Downloads(MySQL社区(GPL)下载)选择 MySQL Community Server(MySQL社区服务器)4.点击Download按钮进行下载5.解压之后的样子(那个png图片是我单独加的,没有也不影响下面的安装)6.已管理员的身份打开cmd命令行窗口7.进入刚才解压后文件的bin目录8.执行初始化数据库的命令mys.
2021-05-01 19:38:00
198
原创 jQuery 时间
$(function () { function time() { var date = new Date(); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hours...
2021-04-29 21:33:22
115
原创 ASP .Net Core 无法将“Add-Migration”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
解决方法:使用NuGet添加Microsoft.EntityFrameworkCore.Tools包
2021-04-27 16:38:36
557
原创 c# 特性
指定参数范围100-200// https://localhost:5001/api/WeatherForecast/abc/101[HttpGet("abc/{id:range(100,200)}")]public ActionResult<string> Get3(int id){ return $"传入的参数是{id}";}使一个action不起作用要添加[NonAction]特性,虽然不添加不影响使用,但在swagger里会报错,建议添加[NonAction]p
2021-04-26 12:48:30
482
原创 Java lambda表达式
Lambda表达式是java8 添加的一个新的特性,Lambda是一个匿名函数为什么要使用Lambda?使用lambda表达式可以对一个接口进行非常简洁的实现Lambda对接口的要求要求接口中要实现的方法只能是一个@FunctionalInterface修饰函数式接口的,表名接口的抽象方法只有一个public class Test2 { public static void main(String[] args) { Comparator comparator = ne
2021-04-25 00:27:07
146
原创 c# lambda表达式 LINQ
入门using System;namespace ConsoleApp5{ class Program { static void Main(string[] args) { Func<int, int, int> func = new Func<int, int, int>((int a, int b) => { return a + b; });
2021-04-23 13:43:15
282
原创 c# 泛型委托 练习
自定义 无参无返回值 委托using System;namespace ConsoleApp5{ // 声明委托,无参数,无返回值 delegate void MyDele(); class Program { static void Main(string[] args) { // dele1这个变量引用着一个MyDele类型的实例, // 这个实例里"包裹"着M1这个方法
2021-04-23 13:10:22
273
原创 c# 结构体
using System;namespace ConsoleApp4{ class Program { static void Main(string[] args) { // student 分配在 栈上 Student student = new Student() {ID = 101, Name = "ll"}; // 装箱 object obj = s
2021-04-23 09:18:29
224
原创 c# 枚举练习
using System;namespace ConsoleApp4{ class Program { static void Main(string[] args) { Person employee = new Person(); employee.Level = Level.Employee; Person boss = new Person(); b
2021-04-22 17:52:56
281
原创 c# 泛型练习 泛型委托
namespace HelloGeneric{ internal class Program { static void Main(string[] args) { int[] a1 = {1, 2, 3, 4, 5}; int[] a2 = {1, 2, 3, 4, 5, 6}; double[] d1 = {1.1, 2.2, 3.3, 4.4, 5.5};
2021-04-22 13:41:36
259
原创 c# 字典
using System;using System.Collections.Generic;namespace HelloGeneric{ internal class Program { static void Main(string[] args) { IDictionary<int, String> dict = new Dictionary<int, string>();
2021-04-22 12:19:06
171
原创 c# 泛型
泛型(generic) 无处不在为什么需要泛型: 避免成员膨胀或者类型膨胀正交性: 泛型类型(类,接口,委托…),泛型成员(属性,字段,方法…)泛型方法的参数推断泛型与委托演示类型膨胀using System;namespace HelloGeneric{ class Program { static void Main(string[] args) { Apple apple = new Apple() {Color
2021-04-20 16:01:15
129
原创 c# 反射 与 依赖注入
using System;using System.Reflection;namespace ConsoleApp2{ class Program { static void Main(string[] args) { ITank tank = new HeavyTank(); var t = tank.GetType(); // Activator 激活器
2021-04-20 15:12:00
286
原创 c# 接口练习2
using System;using System.Collections;namespace ConsoleApp2{ class Program { static void Main(string[] args) { int[] num1 = { 1, 2, 3, 4, 5 }; ArrayList nums2 = new ArrayList { 1, 2, 3, 4, 5 };
2021-04-19 21:29:28
158
原创 c# 接口练习
using System;namespace ConsoleApp2{ class Program { static void Main(string[] args) { var driver = new Driver(new HeavyTank()); driver.Drive(); } } class Driver { private IVeh
2021-04-19 20:40:26
369
原创 c# 测试
using System;using System.Collections;using MyLib;namespace ConsoleApp2{ class Program { static void Main(string[] args) { var fan = new DeskFan(new PowerSupply()); Console.WriteLine(fan.Work());
2021-04-19 14:35:46
326
原创 c# 重写
隐藏这个是不构成重写,这个是子类对父类成员的隐藏 class Vehicle { public void Run() { Console.WriteLine("running"); } } class Car : Vehicle { public void Run() { Console.WriteLine("car is running
2021-04-19 10:53:53
204
转载 c# 访问修饰符
所有类型和类型成员都具有可访问性级别。 该级别可以控制是否可以从你的程序集或其他程序集中的其他代码中使用它们。 可以使用以下访问修饰符在进行声明时指定类型或成员的可访问性:public:同一程序集中的任何其他代码或引用该程序集的其他程序集都可以访问该类型或成员。private:只有同一class 或 struct中的代码可以访问该类型或成员。protected:只有同一 class或者从该 class派生的 class中的代码可以访问该类型或成员。internal:同一程序集中的任何代码都可以访问
2021-04-18 23:17:23
144
原创 c# 委托 和 多线程 Thread Task
namespace ConsoleApp2{ class Program { static void Main(string[] args) { Calculator calculator = new Calculator(); // 委托方式一(方法是无参的) //Report方法后面() Action action = new Action(calculat
2021-04-18 12:02:19
626
1
原创 c# 扩展方法(this参数)
方法必须是共有的,静态的,即被public static所修饰必须是形参列表中的第一个,即this修饰必须由一个静态类(一般名为SomeTypeExtension)来统一收纳对象SomType类型的扩展方法namespace ConsoleApp1{ class Program { static void Main(string[] args) { double x = 3.14159; double.
2021-04-17 14:46:31
241
原创 c# 具名参数
参数的位置不再受约束namespace ConsoleApp1{ class Program { static void Main(string[] args) { PrintInfo(age: 23, name: "ll"); } static void PrintInfo(string name, int age) { Console.WriteLine(
2021-04-17 14:33:30
208
原创 c# 数组参数(params)
namespace ConsoleApp1{ class Program { static void Main(string[] args) { int result = CalculateSum(1, 2, 3); Console.WriteLine(result); } /// <summary> /// 使用params修饰数组,可以直接传入多
2021-04-17 11:57:34
407
原创 c# split
namespace ConsoleApp1{ class Program { static void Main(string[] args) { string str = "Tim;Tom,Amy.List"; string[] result = str.Split(';', ',', '.'); foreach (var item in result) {
2021-04-17 11:55:49
116
原创 c# 输出参数(out)
演示namespace ConsoleApp1{ class Program { static void Main(string[] args) { string str = Console.ReadLine(); double x = 0; bool b1 = double.TryParse(str, out x); if (b1)
2021-04-17 11:44:48
708
原创 c# 引用变量(ref)
namespace ConsoleApp1{ class Program { static void Main(string[] args) { int y = 1; IWantSideEffect(ref y); // 101 Console.WriteLine(y); } static void IWantSideEffect
2021-04-17 10:42:54
1346
原创 c# 常量(const) 和 只读属性(readonly)
namespace ConsoleApp1{ class Program { static void Main(string[] args) { Console.WriteLine(Web.WebsiteURL); Web web = new Web(); Console.WriteLine(web.version); } } class Web
2021-04-16 23:47:30
835
原创 c# 索引器(indexer)
索引器它使对象能像数组一样,即使用下标,进行索引namespace ConsoleApp1{ class Program { static void Main(string[] args) { Student stu = new Student(); stu["Math"] = 90; stu["Math"] = 100; var mathScore = st
2021-04-16 23:00:06
525
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人