问什么一直看我这个图片
欢迎加入 xiaozhi 大家族
首页
推荐
百度一下
腾讯视频
Search
1
小米手机安装CA证书 MIUI13 Android 12可用
538 阅读
2
欢迎家人
225 阅读
3
2020.09.01 HTML 笔记
213 阅读
4
微信公众号推送早安问候以及天气预报 尾部附源码下载链接
199 阅读
5
MP代码生成器
175 阅读
默认分类
HTML初学日记
Java 笔记
小智的生活日记
Java 实用技巧
java面试经典问题
登录
Search
标签搜索
java基础
HTML初学记录
java分享
java抛错
小智
累计撰写
76
篇文章
累计收到
2
条评论
今日撰写
0
篇文章
首页
栏目
默认分类
HTML初学日记
Java 笔记
小智的生活日记
Java 实用技巧
java面试经典问题
页面
推荐
百度一下
腾讯视频
用户登录
登录
搜索到
2
篇与
java分享
的结果
2020-11-24
数据库 常见指令
Structured Query Language sql行 字段 列 记录varchar char一个代表225改表结构 加 tablefrom 在select 之前执行创建库create database d_text; create database 表名;查看有多少库show databases;打开这个库use 库名;创建表 合里边的字段create table t_student (id int primary key AUTO_INCREMENT, username varchar(255) , pwd varchar(32) not null default '123456'); create table 表名 (字段名 属性(大小) 主键 , 字段名 属性(大小) 不为空 默认密码123456);insert into t_score (realname , major, score) value ('libing','java','60') ,('xiaozhi','java','80') ,('aning','数学','59');查里边有里有多少表show tables;增 插入值insert into t_student(字段名1, 字段名2) value ('值1','值2'); insert into 表名 (字段名1, 字段名2) value ('值1','值2');查select * from 表名; select 字段 , 字段 from 表名;删 (and or !=)!= 不等于 <>delete from t_student where username = 'xx' and 1 = 1; delete from 表名 where 字段名 = 'xx' and 布尔表达式;删符合条件的**delete from t_student where username in ('xx','vv');** 删除除过这两个之外的两条delete from t_student where username not in ('xx','vv'); delete from 表名 where 字段名 not in ('值1','值2');模糊查询delete from t_student where username like '%l%'; delete from 表名 where 字段名 like '等于什么';模糊查询 前边delete from t_student where username like 'l%'; delete from 表名 where 字段名 like '等于什么';模糊查询 后边delete from t_student where username like '%l'; delete from 表名 where 字段名 like '等于什么';全部清空 表结构还在TRUNCATE TABLE table_name; TRUNCATE TABLE 表名;查表结构desc t_student; desc 表名;删除表 表结构都删除drop table t_student; drop table 表名;创建表 设置主键create table 表名(字段名称 类型 primary key(字段名称));修改主键alter table t_student add primary key(username); alter table 表名 add primary key(字段);修改update t_student set pwd = '123456' where username = 'qq'; update 表名 set 字段 = 值1 where 字段 = 原本值; update t_student set pwd = '123456',username = 'xiaozhi' where username = 'qq'; update 表名 set 字段1 = 值1 ,字段2 = 值2 where 字段 = 原本值;;加一个字段 不建议使用alter table t_student add (gender varchar(10)); alter table 表名 add (字段 varchar(10));删除一行alter table t_student drop gender; alter table 表名 drop 字段;查询查询设置字段别名 as可以省略select username as '账号' from t_student; select 字段 as '别名' from 表名;查询设置表名别名select `s`.`username` as'账号' from t_student s; 展示 username 这个字段 并把这个表当做s查具有可比较性的 between 数字 两数之间select * from t_score where score between 50 and 70; select * from 表名 where 字段 between 50 and 70; 查前边两个值select * from t_score limit 0,2; select * from 表名 limit 0到第二个;排序升序select * from t_score order by score; select * from 表名 order by 字段;降序select * from t_score order by score desc; select * from 表名 order by 字段 desc;成绩查询 科目没有挂过科的人select realname from t_score where realname not in (select realname from t_score where score < 60);子查询加在from之后必须加别名 as temp;
2020年11月24日
27 阅读
0 评论
1 点赞
2020-11-17
模拟游戏开始
public static void main(String[] args) throws InterruptedException, BrokenBarrierException { Monitor monitor = new Monitor(); monitor.start(); Random random = new Random(); CyclicBarrier cbar = new CyclicBarrier(10); //够五个同时执行 CountDownLatch cdl = new CountDownLatch(10); for (int i = 0; i < 10; i++) { int i1 = random.nextInt(5); Thread.sleep(i1*1000); System.out.println("准备创建" + (i + 1) + "个线程"); ClientThread ct = new ClientThread(cbar,cdl); ct.start(); } cdl.await(); System.out.println(Thread.currentThread().getName() + "游戏开始"); }public class ClientThread extends Thread{ CountDownLatch cdl ; CyclicBarrier cbar ; Random random; public ClientThread(CyclicBarrier cbar,CountDownLatch cdl){ this.cbar = cbar; this.cdl = cdl; random = new Random(); } @Override public void run() { try { System.out.println(Thread.currentThread().getName() + " : 号客户端开始排队"); this.cbar.await(); System.out.println(Thread.currentThread().getName() + " : 号客户端准备就绪"); int i = random.nextInt(10); Thread.sleep(i * 1000); this.cdl.countDown(); this.cdl.await(); System.out.println(Thread.currentThread().getName() + " 游戏开始"); } catch (InterruptedException e) { e.printStackTrace(); } catch (BrokenBarrierException e) { e.printStackTrace(); } } }public class Monitor extends Thread{ @Override public void run() { int i = 1; while (true){ try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(i++); } } }
2020年11月17日
41 阅读
0 评论
0 点赞