Metallo Site Navigation
TSRI Metallo Database Metallo Database The Program Jobs Group Picture More Info Other Links
[MDB navigation] MDB Download Remote Viewer Info SQL Query Advanced Queries Plans for MDB MDB News MDB FAQs MDB Searching Info About MDB Search the MDB Search the MDB Send us Feedback
[MDB - TSRI] Metalloprotein Database and Browser

SQL Help


SQL Query Form MDB Schema Table descriptions SQL Query Examples SQL Help

SQL-Structured Query Language-is a user interface for the storeage and retrieval of information in a relational database.

To allow access to information in a relational database, SQL defines reserve words (operations, functions and commands) of the language which indicates the actions to be performed on the database.

The SQL query interface to the Metalloprotein Database (MDB) offers a limited number of these operators, to preserve the integrity of the database. The SQL reserved words allowed in a MDB query are listed below. (Some are not standard SQL constructs, and reflect our use of mSQL).


The basic SELECT command consists of two parts, called clauses: SELECT <some data> FROM <table name>.

  • SELECT: do not type this clause in the MDB query, it will automatically be entered when the submit button is pressed.

  • FROM: identifies the table name (or names) from where data is to be retrieved.
    SELECT and FROM example:
    SELECT * FROM tabname : selects all columns and rows from the table named "tabname".

  • WHERE: to retrieve specific rows from a table you need to add a WHERE clause; a WHERE clause consists of one or more search conditions. If more than one search condition, these conditions can be connected by logical operators (see Logical Operators section below).

  • ORDER BY: dtaa can be presented to the user in a specific order by using the ORDER BY clause. This clause sorsts the final and remaining rows on the basis of the values in one or more columns, but does not actually change the contents of the results. The ORDER BY clause is always last in the query statement, if no LIMIT clause is used.

  • DISTINCT: used to omit records that contain duplicate data in the selected columns.

Comparison Operators

Comparison operators are used to compare the relative value of two expressions to determine what action should be taken. Comparison operators available:

  • LIKE: compares expression1 with expression2. CASE SENSITIVE.

  • CLIKE: compares express1 with expression2. CASE INSENSITIVE

  • RLIKE: used to compare expressions by using UNIX regular expressions instead of the standard SQL regex.

  • SLIKE: used to compare expressions similar in sound; example: foo SLIKE 'Hughes' would match 'Hues'

Logical Operators

Logical operators are used to connect expressions, usually within a WHERE clause. Logical operators available:

  • AND: used to combine two predicates in WHERE clause, both items MUST be true

  • NOT: used to negate a boolean

  • OR: used to combine two booleans, this combination is true ONLY if one or both of the booleans are true

Miscellaneous

  • LIMIT n: used to limit the number of results to the first "n" rows, e.g. SELECT foo from bar where foo='zoot' LIMIT 10. This must be the last clause used.

Somewhere on the web

Here are some helpful links regarding SQL. Be aware that you will not be able to use every single command spoken about in the tutorials, only the ones mentioned above, but they may give you a better idea about SQL queries.



Use the interactive interface to search the MDB Database

MDB Site: About the MDB | Searching the MDB | MDB's FAQ | News and Release History | Future Plans

Advanced Queries | SQL Query | Remote Viewer and How to use it | MDB downloads | Feedback


Metalloprotein Structure and Design Site:

TSRI Main Page | MetalloProtein Program Main Page | Metalloprotein Database & Browser

About the Program | Employment & Research Opportunities

Group Picture | For More Information | Feedback & Inquiries | Other Web Resources

Page maintained by Jesus M. Castagnetto (jesusmc@scripps.edu) - © The Scripps Research Institute.
Document: http://metallo.scripps.edu/sql_docs/sql_help.html
Last modified: Wednesday, Apr 10, 2002 at 14:41 (PDT) - Last accessed: Saturday, Jul 26, 2008 at 18:37 (PDT)
Valid HTML 4.0!