十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
1、查詢重復(fù)的數(shù)據(jù),只查詢重復(fù)記錄,不管其余信息,如ID什么的:
創(chuàng)新互聯(lián)是專業(yè)的遷安網(wǎng)站建設(shè)公司,遷安接單;提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行遷安網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
1select uid, time from ztest GROUP BY uid, time having count(*)1;
查出結(jié)果是
uid time
1 1
2、SQL語言,是結(jié)構(gòu)化查詢語言(Structured Query Language)的簡稱。SQL語言是一種數(shù)據(jù)庫查詢和程序設(shè)計(jì)語言,用于存取數(shù)據(jù)以及查詢、更新和管理關(guān)系數(shù)據(jù)庫系統(tǒng);同時(shí)也是數(shù)據(jù)庫腳本文件的擴(kuò)展名。
3、SQL語言是高級的非過程化編程語言,允許用戶在高層數(shù)據(jù)結(jié)構(gòu)上工作。它不要求用戶指定對數(shù)據(jù)的存放方法,也不需要用戶了解具體的數(shù)據(jù)存放方式,所以具有完全不同底層結(jié)構(gòu)的不同數(shù)據(jù)庫系統(tǒng)可以使用相同的結(jié)構(gòu)化查詢語言作為數(shù)據(jù)輸入與管理的接口。SQL語言語句可以嵌套,這使他具有極大的靈活性和強(qiáng)大的功能。
交集是兩個(gè)集合的公共元素,即兩個(gè)方程的公共解;
并集是兩個(gè)集合的元素的總個(gè)數(shù)(相同的元素只寫一次);
差集:如果兩個(gè)集合有交集,則大集元素中所有不屬于小集合的元素的集合是差集,如果沒有交集(空集),則A-B=A, B-A=B
首先你想要的結(jié)果集中的第三行應(yīng)該有一點(diǎn)筆誤,應(yīng)該為“3 a3 b3“;
要實(shí)現(xiàn)你要的結(jié)果集,A、B兩表各自ID字段下應(yīng)該是不允許有重復(fù)值(ID)出現(xiàn)的,否則情況會變得復(fù)雜、結(jié)果難于預(yù)料,有些情形下單純使用SQL語句是無法處理的。或許有人會說對ID取唯一值不就行了嗎?的確可以,但是這又會出現(xiàn)如果A表或B表同一個(gè)ID下有多個(gè)不同記錄(同ID但是多個(gè)不同的A1或B1字段值)時(shí)到底取哪一條記錄的問題。因此下面SQL代碼將基于單一表下無重復(fù)ID而設(shè)計(jì)。
我看到上面一些熱情網(wǎng)友給出了各自的答案,其中 使用“FULL OUTER”連接是一種較簡便的解決方式,但是全外連接對于一些小型的數(shù)據(jù)庫系統(tǒng)并不適用(如ACCESS數(shù)據(jù)庫),另外“ISNULL(A.ID, B.ID)”、decode(t.id ,null,t1.id,t.id)這類函數(shù)也只能使用于特定的數(shù)據(jù)庫系統(tǒng),通用性有問題。
下面SQL代碼使用基本的SQL操作符編寫,適用于大部分?jǐn)?shù)據(jù)庫系統(tǒng),已經(jīng)通過測試,其中“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里的關(guān)鍵字,要中括號括起來
SQL(結(jié)構(gòu)化查詢語言)用于存取數(shù)據(jù)以及查詢、更新和管理關(guān)系數(shù)據(jù)庫系統(tǒng)。
SQL基于關(guān)系代數(shù)和元組關(guān)系演算,包括一個(gè)數(shù)據(jù)定義語言和數(shù)據(jù)操縱語言。SQL的范圍包括數(shù)據(jù)插入、查詢、更新和刪除,數(shù)據(jù)庫模式創(chuàng)建和修改,以及數(shù)據(jù)訪問控制。盡管很大程度上是一種聲明式編程(4GL),但是其也含有過程式編程的元素。
SQL是對埃德加·科德的關(guān)系模型的第一個(gè)商業(yè)化語言實(shí)現(xiàn),這一模型在其1970年的一篇具有影響力的論文《一個(gè)對于大型共享型數(shù)據(jù)庫的關(guān)系模型》中被描述。
盡管SQL并非完全按照科德的關(guān)系模型設(shè)計(jì),但其依然成為最為廣泛運(yùn)用的數(shù)據(jù)庫語言。SQL在1986年成為美國國家標(biāo)準(zhǔn)學(xué)會(ANSI)的一項(xiàng)標(biāo)準(zhǔn),在1987年成為國際標(biāo)準(zhǔn)化組織(ISO)標(biāo)準(zhǔn)。此后,這一標(biāo)準(zhǔn)經(jīng)過了一系列的增訂,加入了大量新特性。
擴(kuò)展資料:
SQL是高級的非過程化編程語言,它允許用戶在高層數(shù)據(jù)結(jié)構(gòu)上工作。它不要求用戶指定對數(shù)據(jù)的存放方法,也不需要用戶了解其具體的數(shù)據(jù)存放方式。而它的界面,能使具有底層結(jié)構(gòu)完全不同的數(shù)據(jù)庫系統(tǒng)和不同數(shù)據(jù)庫之間,使用相同的SQL作為數(shù)據(jù)的輸入與管理。
它以記錄項(xiàng)目〔records〕的合集(set)〔項(xiàng)集,record set〕作為操縱對象,所有SQL語句接受項(xiàng)集作為輸入,回提交的項(xiàng)集作為輸出,這種項(xiàng)集特性允許一條SQL語句的輸出作為另一條SQL語句的輸入,所以SQL語句可以嵌套,這使它擁有極大的靈活性和強(qiáng)大的功能。
在多數(shù)情況下,在其他編程語言中需要用一大段程序才可實(shí)踐的一個(gè)單獨(dú)事件,而其在SQL上只需要一個(gè)語句就可以被表達(dá)出來。這也意味著用SQL可以寫出非常復(fù)雜的語句,在不特別考慮性能下。
參考資料來源:百度百科-結(jié)構(gòu)化查詢語言
分布式領(lǐng)域論文譯序
sqlnosql年代記
SMAQ:海量數(shù)據(jù)的存儲計(jì)算和查詢
一.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文件系統(tǒng) (譯)
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:租約機(jī)制 (譯)
5. Time Clocks and the Ordering of Events in a Distributed System(譯) --Leslie Lamport
6. 關(guān)于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
分布式理論系列論文翻譯集(合集)
三.?dāng)?shù)據(jù)庫理論系列
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
四.大規(guī)模存儲與計(jì)算(NoSql理論系列)
0. Towards Robust Distributed Systems:Brewer's 2000 PODC key notes
1. CAP理論
2. Harvest, Yield, and Scalable Tolerant Systems
3. 關(guān)于CAP
4. BASE模型:BASE an Acid Alternative
5. 最終一致性
6. 可擴(kuò)展性設(shè)計(jì)模式
7. 可伸縮性原則
8. NoSql生態(tài)系統(tǒng)
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. 關(guān)于MapReduce的爭論
14. MapReduce:一個(gè)巨大的倒退
15. MapReduce:一個(gè)巨大的倒退(II)
16. MapReduce和并行數(shù)據(jù)庫,朋友還是敵人?(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:圖計(jì)算概覽
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
五.基本算法和數(shù)據(jù)結(jié)構(gòu)
1. 大數(shù)據(jù)量,海量數(shù)據(jù)處理方法總結(jié)
2. 大數(shù)據(jù)量,海量數(shù)據(jù)處理方法總結(jié)(續(xù))
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
六.基本系統(tǒng)和實(shí)踐經(jīng)驗(yàn)
1. MySQL索引背后的數(shù)據(jù)結(jié)構(gòu)及算法原理
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!的分布式數(shù)據(jù)平臺PNUTS簡介及感悟(zz)
6. LevelDB:一個(gè)快速輕量級的key-value存儲庫(譯)
7. LevelDB理論基礎(chǔ)
8. LevelDB:實(shí)現(xiàn)(譯)
9. LevelDB SSTable格式詳解
10. LevelDB Bloom Filter實(shí)現(xiàn)
11. Sawzall原理與應(yīng)用
12. Storm原理與實(shí)現(xiàn)
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
七.其他輔助系統(tǒng)
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相關(guān)
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
轉(zhuǎn)載請注明作者:phylips@bmy 2011-4-30