随笔分类 -  数据库

摘要:Table: Teams + + +| Column Name | Type |+ + +| team_id | int || team_name | varchar |+ + +team_id is the primary key of this table.Each row of this ta 阅读全文
posted @ 2019-11-20 23:51 lihui1625 阅读(220) 评论(0) 推荐(0)
摘要:SQL架构 Transactions 记录表 + + + | Column Name | Type | + + + | id | int | | country | varchar | | state | enum | | amount | int | | trans_date | date | + 阅读全文
posted @ 2019-11-20 23:50 lihui1625 阅读(231) 评论(0) 推荐(0)
摘要:书籍表 Books: + + +| Column Name | Type |+ + +| book_id | int || name | varchar || available_from | date |+ + +book_id 是这个表的主键。订单表 Orders: + + +| Column 阅读全文
posted @ 2019-11-20 23:49 lihui1625 阅读(248) 评论(0) 推荐(0)
摘要:Table: Queue + + +| Column Name | Type |+ + +| person_id | int || person_name | varchar || weight | int || turn | int |+ + +person_id is the primary k 阅读全文
posted @ 2019-11-20 23:47 lihui1625 阅读(451) 评论(0) 推荐(0)
摘要:Employee 表保存了一年内的薪水信息。 请你编写 SQL 语句,来查询一个员工三个月内的累计薪水,但是不包括最近一个月的薪水。 结果请按 'Id' 升序,然后按 'Month' 降序显示。 示例:输入: | Id | Month | Salary || | | || 1 | 1 | 20 || 阅读全文
posted @ 2019-11-20 23:46 lihui1625 阅读(637) 评论(0) 推荐(0)
摘要:Table: Spending + + +| Column Name | Type |+ + +| user_id | int || spend_date | date || platform | enum | | amount | int |+ + +The table logs the spen 阅读全文
posted @ 2019-11-20 23:45 lihui1625 阅读(214) 评论(0) 推荐(0)
摘要:SQL架构 Table: Failed + + + | Column Name | Type | + + + | fail_date | date | + + + 该表主键为 fail_date。 该表包含失败任务的天数. Table: Succeeded + + + | Column Name | 阅读全文
posted @ 2019-11-20 23:44 lihui1625 阅读(452) 评论(0) 推荐(0)
摘要:SQL架构 Players 玩家表 + + + | Column Name | Type | + + + | player_id | int | | group_id | int | + + + 玩家 ID 是此表的主键。 此表的每一行表示每个玩家的组。 Matches 赛事表 + + + | Co 阅读全文
posted @ 2019-11-20 23:43 lihui1625 阅读(468) 评论(0) 推荐(0)
摘要:SQL架构 Activity 活动记录表 + + + | Column Name | Type | + + + | player_id | int | | device_id | int | | event_date | date | | games_played | int | + + + (pl 阅读全文
posted @ 2019-11-20 23:42 lihui1625 阅读(272) 评论(0) 推荐(0)
摘要:SQL架构 一所美国大学有来自亚洲、欧洲和美洲的学生,他们的地理信息存放在如下 student 表中。 | name | continent | | | | | Jack | America | | Pascal | Europe | | Xi | Asia | | Jane | America | 阅读全文
posted @ 2019-11-20 23:41 lihui1625 阅读(351) 评论(0) 推荐(0)
摘要:SQL架构 Numbers 表保存数字的值及其频率。 + + + | Number | Frequency | + + | | 0 | 7 | | 1 | 1 | | 2 | 3 | | 3 | 1 | + + + 在此表中,数字为 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 阅读全文
posted @ 2019-11-20 23:40 lihui1625 阅读(979) 评论(0) 推荐(0)
摘要:SQL架构 Employee 表包含所有员工。Employee 表有三列:员工Id,公司名和薪水。 + + + + |Id | Company | Salary | + + + + |1 | A | 2341 | |2 | A | 341 | |3 | A | 15 | |4 | A | 15314 阅读全文
posted @ 2019-11-20 23:39 lihui1625 阅读(969) 评论(0) 推荐(0)
摘要:一、MODEL 子句 1、实例 model 子句可进行行间计算。 结果: 2、位置标记和符号标记访问数据单元 在以上的SQL中保留位置和符号标记 结果与实例中一样 3、between and 用在measure中的聚合计算中。 4、any、is any any 与位置标记合用,is any 与符号标 阅读全文
posted @ 2015-10-03 23:37 lihui1625 阅读(402) 评论(0) 推荐(0)
摘要:1、评级函数 (1). 排序rank()、dense_rank() 遇到重复的,rank()下一个加2,dense_rank() 下一个加1 结果: 还可以通过 NULLS LAST 或 NULLS FIRST 控制null放在首位或末位 与PARTITION BY 子句结合使用 结果: rank( 阅读全文
posted @ 2015-10-03 23:14 lihui1625 阅读(274) 评论(0) 推荐(0)
摘要:1. 集合操作 union all 、 union、 intersect 、 minus 注意:集合操作的所有查询返回的列数、列类型必须相同,但是列名可以不一样。 2、translate 函数 translate(x, str1, str2) . 在字段x 中查找str1中的字符,转化为str2中对 阅读全文
posted @ 2015-10-03 18:04 lihui1625 阅读(278) 评论(0) 推荐(0)
摘要:1、Oracle 架构基础SGA:系统全局内存区,每一个实例只有一个PGA:程序共享内存区,每一个服务器进程有一个2. SGA 之 共享池库高速缓存:解析每一句语句之前,Oracle会检查库高速缓存中是否存在相同语句,如果存在,则直接取出,若无再进行解析。通过最近最少使用算法,管理其中对象。数据字典... 阅读全文
posted @ 2015-10-01 21:43 lihui1625 阅读(289) 评论(0) 推荐(0)
摘要:1、SELECT 语句的标量子查询 select c.customer_id, c.cust_first_name||' '||c.cust_last_name as fullname,(select e.last_name from hr.employees e where e.employee_... 阅读全文
posted @ 2015-09-29 19:51 lihui1625 阅读(142) 评论(0) 推荐(0)
摘要:http://mousepc.iteye.com/blog/1131462业务场景:当需要向数据库发送一批SQL语句执行时,应避免向数据库一条条的发送执行,而应采用JDBC的批处理机制,以提升执行效率。实现批处理有两种方式: 第一种方式:使用 Statement.addBatch(sql)Conne... 阅读全文
posted @ 2015-09-29 16:32 lihui1625 阅读(145) 评论(0) 推荐(0)
摘要:事务处理方式在JDBC连接中,使用命令声明事务的开始、提交和取消。如前一章介绍的数据库处理方式,它通过java.sql.Connection接口实现,可以启用AutoCommit。这种方式使用简单,但性能较低。利用JavaEE规范的JTA驱动程序。这种方式性能更好,是EJB和JMS的常用方式。Jav... 阅读全文
posted @ 2015-09-22 01:51 lihui1625 阅读(252) 评论(0) 推荐(0)
摘要:1、Oracle ORACLE_VERSION : SELECT BANNER FROM v$version CHAR_SETTING : SELECT value FROM NLS_DATABAS... 阅读全文
posted @ 2015-09-21 21:55 lihui1625 阅读(250) 评论(0) 推荐(0)