十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
1、查询重复的数据,只查询重复记录,不管其余信息,如ID什么的:
创新互联是专业的迁安网站建设公司,迁安接单;提供成都网站设计、网站建设、外贸网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行迁安网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
1select uid, time from ztest GROUP BY uid, time having count(*)1;
查出结果是
uid time
1 1
2、SQL语言,是结构化查询语言(Structured Query Language)的简称。SQL语言是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统;同时也是数据库脚本文件的扩展名。
3、SQL语言是高级的非过程化编程语言,允许用户在高层数据结构上工作。它不要求用户指定对数据的存放方法,也不需要用户了解具体的数据存放方式,所以具有完全不同底层结构的不同数据库系统可以使用相同的结构化查询语言作为数据输入与管理的接口。SQL语言语句可以嵌套,这使他具有极大的灵活性和强大的功能。
交集是两个集合的公共元素,即两个方程的公共解;
并集是两个集合的元素的总个数(相同的元素只写一次);
差集:如果两个集合有交集,则大集元素中所有不属于小集合的元素的集合是差集,如果没有交集(空集),则A-B=A, B-A=B
首先你想要的结果集中的第三行应该有一点笔误,应该为“3 a3 b3“;
要实现你要的结果集,A、B两表各自ID字段下应该是不允许有重复值(ID)出现的,否则情况会变得复杂、结果难于预料,有些情形下单纯使用SQL语句是无法处理的。或许有人会说对ID取唯一值不就行了吗?的确可以,但是这又会出现如果A表或B表同一个ID下有多个不同记录(同ID但是多个不同的A1或B1字段值)时到底取哪一条记录的问题。因此下面SQL代码将基于单一表下无重复ID而设计。
我看到上面一些热情网友给出了各自的答案,其中 使用“FULL OUTER”连接是一种较简便的解决方式,但是全外连接对于一些小型的数据库系统并不适用(如ACCESS数据库),另外“ISNULL(A.ID, B.ID)”、decode(t.id ,null,t1.id,t.id)这类函数也只能使用于特定的数据库系统,通用性有问题。
下面SQL代码使用基本的SQL操作符编写,适用于大部分数据库系统,已经通过测试,其中“T” 和“T1”分别是其中子查询的别名:
SELECT T1.ID, T1.A1, B.B1 FROM (SELECT T.ID,A.A1 from (SELECT ID FROM A UNION SELECT ID FROM B)T LEFT JOIN A ON T.ID=A.ID)T1 LEFT JOIN B ON T1.ID=B.ID ORDER BY T1.ID;
insert into [User] (UserId,Name,LoginName,Pwd)values(5,123,31321,1);
user是sqlserver里的关键字,要中括号括起来
SQL(结构化查询语言)用于存取数据以及查询、更新和管理关系数据库系统。
SQL基于关系代数和元组关系演算,包括一个数据定义语言和数据操纵语言。SQL的范围包括数据插入、查询、更新和删除,数据库模式创建和修改,以及数据访问控制。尽管很大程度上是一种声明式编程(4GL),但是其也含有过程式编程的元素。
SQL是对埃德加·科德的关系模型的第一个商业化语言实现,这一模型在其1970年的一篇具有影响力的论文《一个对于大型共享型数据库的关系模型》中被描述。
尽管SQL并非完全按照科德的关系模型设计,但其依然成为最为广泛运用的数据库语言。SQL在1986年成为美国国家标准学会(ANSI)的一项标准,在1987年成为国际标准化组织(ISO)标准。此后,这一标准经过了一系列的增订,加入了大量新特性。
扩展资料:
SQL是高级的非过程化编程语言,它允许用户在高层数据结构上工作。它不要求用户指定对数据的存放方法,也不需要用户了解其具体的数据存放方式。而它的界面,能使具有底层结构完全不同的数据库系统和不同数据库之间,使用相同的SQL作为数据的输入与管理。
它以记录项目〔records〕的合集(set)〔项集,record set〕作为操纵对象,所有SQL语句接受项集作为输入,回提交的项集作为输出,这种项集特性允许一条SQL语句的输出作为另一条SQL语句的输入,所以SQL语句可以嵌套,这使它拥有极大的灵活性和强大的功能。
在多数情况下,在其他编程语言中需要用一大段程序才可实践的一个单独事件,而其在SQL上只需要一个语句就可以被表达出来。这也意味着用SQL可以写出非常复杂的语句,在不特别考虑性能下。
参考资料来源:百度百科-结构化查询语言
分布式领域论文译序
sqlnosql年代记
SMAQ:海量数据的存储计算和查询
一.google论文系列
1. google系列论文译序
2. The anatomy of a large-scale hypertextual Web search engine (译 zz)
3. web search for a planet :the google cluster architecture(译)
4. GFS:google文件系统 (译)
5. MapReduce: Simplied Data Processing on Large Clusters (译)
6. Bigtable: A Distributed Storage System for Structured Data (译)
7. Chubby: The Chubby lock service for loosely-coupled distributed systems (译)
8. Sawzall:Interpreting the Data--Parallel Analysis with Sawzall (译 zz)
9. Pregel: A System for Large-Scale Graph Processing (译)
10. Dremel: Interactive Analysis of WebScale Datasets(译zz)
11. Percolator: Large-scale Incremental Processing Using Distributed Transactions and Notifications(译zz)
12. MegaStore: Providing Scalable, Highly Available Storage for Interactive Services(译zz)
13. Case Study GFS: Evolution on Fast-forward (译)
14. Google File System II: Dawn of the Multiplying Master Nodes
15. Tenzing - A SQL Implementation on the MapReduce Framework (译)
16. F1-The Fault-Tolerant Distributed RDBMS Supporting Google's Ad Business
17. Elmo: Building a Globally Distributed, Highly Available Database
18. PowerDrill:Processing a Trillion Cells per Mouse Click
19. Google-Wide Profiling:A Continuous Profiling Infrastructure for Data Centers
20. Spanner: Google’s Globally-Distributed Database(译zz)
21. Dapper, a Large-Scale Distributed Systems Tracing Infrastructure(笔记)
22. Omega: flexible, scalable schedulers for large compute clusters
23. CPI2: CPU performance isolation for shared compute clusters
24. Photon: Fault-tolerant and Scalable Joining of Continuous Data Streams(译)
25. F1: A Distributed SQL Database That Scales
26. MillWheel: Fault-Tolerant Stream Processing at Internet Scale(译)
27. B4: Experience with a Globally-Deployed Software Defined WAN
28. The Datacenter as a Computer
29. Google brain-Building High-level Features Using Large Scale Unsupervised Learning
30. Mesa: Geo-Replicated, Near Real-Time, Scalable Data Warehousing(译zz)
31. Large-scale cluster management at Google with Borg
google系列论文翻译集(合集)
二.分布式理论系列
00. Appraising Two Decades of Distributed Computing Theory Research
0. 分布式理论系列译序
1. A brief history of Consensus_ 2PC and Transaction Commit (译)
2. 拜占庭将军问题 (译) --Leslie Lamport
3. Impossibility of distributed consensus with one faulty process (译)
4. Leases:租约机制 (译)
5. Time Clocks and the Ordering of Events in a Distributed System(译) --Leslie Lamport
6. 关于Paxos的历史
7. The Part Time Parliament (译 zz) --Leslie Lamport
8. How to Build a Highly Available System Using Consensus(译)
9. Paxos Made Simple (译) --Leslie Lamport
10. Paxos Made Live - An Engineering Perspective(译)
11. 2 Phase Commit(译)
12. Consensus on Transaction Commit(译) --Jim Gray Leslie Lamport
13. Why Do Computers Stop and What Can Be Done About It?(译) --Jim Gray
14. On Designing and Deploying Internet-Scale Services(译) --James Hamilton
15. Single-Message Communication(译)
16. Implementing fault-tolerant services using the state machine approach
17. Problems, Unsolved Problems and Problems in Concurrency
18. Hints for Computer System Design
19. Self-stabilizing systems in spite of distributed control
20. Wait-Free Synchronization
21. White Paper Introduction to IEEE 1588 Transparent Clocks
22. Unreliable Failure Detectors for Reliable Distributed Systems
23. Life beyond Distributed Transactions:an Apostate’s Opinion(译zz)
24. Distributed Snapshots: Determining Global States of a Distributed System --Leslie Lamport
25. Virtual Time and Global States of Distributed Systems
26. Timestamps in Message-Passing Systems That Preserve the Partial Ordering
27. Fundamentals of Distributed Computing:A Practical Tour of Vector Clock Systems
28. Knowledge and Common Knowledge in a Distributed Environment
29. Understanding Failures in Petascale Computers
30. Why Do Internet services fail, and What Can Be Done About It?
31. End-To-End Arguments in System Design
32. Rethinking the Design of the Internet: The End-to-End Arguments vs. the Brave New World
33. The Design Philosophy of the DARPA Internet Protocols(译zz)
34. Uniform consensus is harder than consensus
35. Paxos made code - Implementing a high throughput Atomic Broadcast
36. RAFT:In Search of an Understandable Consensus Algorithm
分布式理论系列论文翻译集(合集)
三.数据库理论系列
0. A Relational Model of Data for Large Shared Data Banks --E.F.Codd 1970
1. SEQUEL:A Structured English Query Language 1974
2. Implentation of a Structured English Query Language 1975
3. A System R: Relational Approach to Database Management 1976
4. Granularity of Locks and Degrees of Consistency in a Shared DataBase --Jim Gray 1976
5. Access Path Selection in a RDBMS 1979
6. The Transaction Concept:Virtues and Limitations --Jim Gray
7. 2pc-2阶段提交:Notes on Data Base Operating Systems --Jim Gray
8. 3pc-3阶段提交:NONBLOCKING COMMIT PROTOCOLS
9. MVCC:Multiversion Concurrency Control-Theory and Algorithms --1983
10. ARIES: A Transaction Recovery Method Supporting Fine-Granularity Locking and Partial Rollbacks Using Write-Ahead Logging-1992
11. A Comparison of the Byzantine Agreement Problem and the Transaction Commit Problem --Jim Gray
12. A Formal Model of Crash Recovery in a Distributed System - Skeen, D. Stonebraker
13. What Goes Around Comes Around - Michael Stonebraker, Joseph M. Hellerstein
14. Anatomy of a Database System -Joseph M. Hellerstein, Michael Stonebraker
15. Architecture of a Database System(译zz) -Joseph M. Hellerstein, Michael Stonebraker, James Hamilton
四.大规模存储与计算(NoSql理论系列)
0. Towards Robust Distributed Systems:Brewer's 2000 PODC key notes
1. CAP理论
2. Harvest, Yield, and Scalable Tolerant Systems
3. 关于CAP
4. BASE模型:BASE an Acid Alternative
5. 最终一致性
6. 可扩展性设计模式
7. 可伸缩性原则
8. NoSql生态系统
9. scalability-availability-stability-patterns
10. The 5 Minute Rule and the 5 Byte Rule (译)
11. The Five-Minute Rule Ten Years Later and Other Computer Storage Rules of Thumb
12. The Five-Minute Rule 20 Years Later(and How Flash Memory Changes the Rules)
13. 关于MapReduce的争论
14. MapReduce:一个巨大的倒退
15. MapReduce:一个巨大的倒退(II)
16. MapReduce和并行数据库,朋友还是敌人?(zz)
17. MapReduce and Parallel DBMSs-Friends or Foes (译)
18. MapReduce:A Flexible Data Processing Tool (译)
19. A Comparision of Approaches to Large-Scale Data Analysis (译)
20. MapReduce Hold不住?(zz)
21. Beyond MapReduce:图计算概览
22. Map-Reduce-Merge: simplified relational data processing on large clusters
23. MapReduce Online
24. Graph Twiddling in a MapReduce World
25. Spark: Cluster Computing with Working Sets
26. Resilient Distributed Datasets: A Fault-Tolerant Abstraction for In-Memory Cluster Computing
27. Big Data Lambda Architecture
28. The 8 Requirements of Real-Time Stream Processing
29. The Log: What every software engineer should know about real-time data's unifying abstraction
30. Lessons from Giant-Scale Services
五.基本算法和数据结构
1. 大数据量,海量数据处理方法总结
2. 大数据量,海量数据处理方法总结(续)
3. Consistent Hashing And Random Trees
4. Merkle Trees
5. Scalable Bloom Filters
6. Introduction to Distributed Hash Tables
7. B-Trees and Relational Database Systems
8. The log-structured merge-tree (译)
9. lock free data structure
10. Data Structures for Spatial Database
11. Gossip
12. lock free algorithm
13. The Graph Traversal Pattern
六.基本系统和实践经验
1. MySQL索引背后的数据结构及算法原理
2. Dynamo: Amazon’s Highly Available Key-value Store (译zz)
3. Cassandra - A Decentralized Structured Storage System (译zz)
4. PNUTS: Yahoo!’s Hosted Data Serving Platform (译zz)
5. Yahoo!的分布式数据平台PNUTS简介及感悟(zz)
6. LevelDB:一个快速轻量级的key-value存储库(译)
7. LevelDB理论基础
8. LevelDB:实现(译)
9. LevelDB SSTable格式详解
10. LevelDB Bloom Filter实现
11. Sawzall原理与应用
12. Storm原理与实现
13. Designs, Lessons and Advice from Building Large Distributed Systems --Jeff Dean
14. Challenges in Building Large-Scale Information Retrieval Systems --Jeff Dean
15. Experiences with MapReduce, an Abstraction for Large-Scale Computation --Jeff Dean
16. Taming Service Variability,Building Worldwide Systems,and Scaling Deep Learning --Jeff Dean
17. Large-Scale Data and Computation:Challenges and Opportunitis --Jeff Dean
18. Achieving Rapid Response Times in Large Online Services --Jeff Dean
19. The Tail at Scale(译) --Jeff Dean Luiz André Barroso
20. How To Design A Good API and Why it Matters
21. Event-Based Systems:Architect's Dream or Developer's Nightmare?
22. Autopilot: Automatic Data Center Management
七.其他辅助系统
1. The ganglia distributed monitoring system:design, implementation, and experience
2. Chukwa: A large-scale monitoring system
3. Scribe : a way to aggregate data and why not, to directly fill the HDFS?
4. Benchmarking Cloud Serving Systems with YCSB
5. Dynamo Dremel ZooKeeper Hive 简述
八. Hadoop相关
0. Hadoop Reading List
1. The Hadoop Distributed File System(译)
2. HDFS scalability:the limits to growth(译)
3. Name-node memory size estimates and optimization proposal.
4. HBase Architecture(译)
5. HFile:A Block-Indexed File Format to Store Sorted Key-Value Pairs
6. HFile V2
7. Hive - A Warehousing Solution Over a Map-Reduce Framework
8. Hive – A Petabyte Scale Data Warehouse Using Hadoop
转载请注明作者:phylips@bmy 2011-4-30