Advanced SQL Techniques - Part 1: Analyzing Duplicate Records
2566Advanced SQL Techniques - Part 1: Analyzing Duplicate Recordshttp://www.15seconds.com/issue/011009.htmThis article offers an analysis of Structured Query Language (SQL) and presents techniques that can be used in building SQL statements. People tend to think of SQL as a programming language, but in reality, SQL is a Set language. One could say SQL is Set Theory or Relational Algebra; these terms are interchangeable. Some people think of this in terms of Venn diagrams or DeMorgan's Law. Although those can be quite complicated, the basic forms are not difficult to understand. The cases presented here are intended for certain circumstances, but they can be applied to many situations. Each article in this four-part series will address one case.ASP > Tips and Tutorials > Database-relatedOct 10, 2006
Active Server Pages allow us an easy means of querying and updating a database from a webpage. This article describes the basics of using this technique in a nutshell. The examples given here utilize a Microsoft Access database, but the principles elucidated apply equally well to ASP integration with other databaes. (Access has been selected because it is widely familiar, easy to use, and adequate for many small to medium-sized projects.)
Filter method is very useful working with large datasets. You might need to put only some records from your database but you should select all data from database. Fileter method is advantage working on recordsets after querying on SQL command.
This is a topic I've seen covered by others in the past but never in enough detail to satisfy me. This technique is extremely powerful and can yield huge performance gains over non-cached queries and therefore deserves more attention.
When you're querying a Db typically you're looking for an exact match (=), less than (<), greater than (>), less than or equal to (<=), greater than or equal to (=>), or not equal to (< >). Which give you quite a number of ways that you can display your data, but with these operators a partial match is not allowed. In order to facilitate a partial match the like operator must be used and it's entirely up to you how that match is made. The example db contains most of the Titles, AirDates and What Bart Simpson writes in the blackboard at the beginning of The Simpson's (TM).
Outputting data from two tables is almost as easy as displaying from one. This example utilizes two tables with state information on them. The first table (state_order) contains state abbreviations (state), state names (statename) the year each state was admitted into the union (year) and the numeric order they entered in (entered) . The second table (state_capitals) contains state abbreviations (state), state names (state) and state capitals (capital). The where statement (state_order.state = state_capitals.state) looks to make a match on the field that each table has in common to ouput the correct capital with all the info from the state_order table
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.