Structured Query Language (SQL) - Cultural View of Technology

Structured Query Language (SQL) - Cultural View of Technology Structured Query Language (SQL) - Cultural View of Technology

culturalview.com
from culturalview.com More from this publisher
23.10.2012 Views

Epictetus Database Client 52 Epictetus Database Client Developer(s) Antilogic Software Stable release 1.0 beta / June 17, 2009 Operating system Platform Java Cross-platform Type Database administration tool License Freeware Website antilogics.com [1] Epictetus is free cross-platform multi-database administration tool. Epictetus requires JVM to run. Epictetus is distributed under the Freeware License. Feature Summary • Multithreading • Autocomplete • Primary and foreign keys highlight • BLOB, CLOB autoload • SQL syntax highlight • Query history • Schema browser • Edit table data • Restore last opened windows • Autoupdate History The Epictetus was developed by the Antilogic Software [2] . Supported databases • Oracle Database 8i, 9i, 10g, 11g • Microsoft SQL Server • MySQL • InterBase/Firebird • PostgreSQL • HSQLDB • H2

Epictetus Database Client 53 External links • Antilogic Software - Epictetus [3] • Interview: Konstantin Chikarev on Epictetus Database Manager [4] References [1] http://antilogics.com/ [2] http://www.antilogics.com/ [3] http://www.antilogics.com/epictetus.html [4] http://java.dzone.com/news/interview-konstantin-chikarev- Foreign key In the context of relational databases, a foreign key is a referential constraint between two tables. [1] The foreign key identifies a column or a set of columns in one (referencing) table that refers to set of columns in another (referenced) table. The columns in the referencing table must be the primary key or other candidate key in the referenced table. The values in one row of the referencing columns must occur in a single row in the referenced table. Thus, a row in the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL). This way references can be made to link information together and it is an essential part of database normalization. Multiple rows in the referencing table may refer to the same row in the referenced table. Most of the time, it reflects the one (master table, or referenced table) to many (child table, or referencing table) relationship. The referencing and referenced table may be the same table, i.e. the foreign key refers back to the same table. Such a foreign key is known in SQL:2003 as a self-referencing or recursive foreign key. A table may have multiple foreign keys, and each foreign key can have a different referenced table. Each foreign key is enforced independently by the database system. Therefore, cascading relationships between tables can be established using foreign keys. Improper foreign key/primary key relationships or not enforcing those relationships are often the source of many database and data modeling problems. Defining Foreign Keys Foreign keys are defined in the ANSI SQL Standard, through a FOREIGN KEY constraint. The syntax to add such a constraint to an existing table is defined in SQL:2003 as shown below. Omitting the column list in the REFERENCES clause implies that the foreign key shall reference the primary key of the referenced table. ALTER TABLE ADD [ CONSTRAINT ] FOREIGN KEY ( {, }... ) REFERENCES [ ( {, }... ) [ ON UPDATE ] [ ON DELETE ] Likewise, foreign keys can be defined as part of the CREATE TABLE SQL statement. CREATE TABLE table_name ( id INTEGER PRIMARY KEY, col2 CHARACTER VARYING(20), col3 INTEGER, ...

Epictetus Database Client 53<br />

External links<br />

• Antilogic S<strong>of</strong>tware - Epictetus [3]<br />

• Interview: Konstantin Chikarev on Epictetus Database Manager [4]<br />

References<br />

[1] http://antilogics.com/<br />

[2] http://www.antilogics.com/<br />

[3] http://www.antilogics.com/epictetus.html<br />

[4] http://java.dzone.com/news/interview-konstantin-chikarev-<br />

Foreign key<br />

In the context <strong>of</strong> relational databases, a foreign key is a referential constraint between two tables. [1] The foreign key<br />

identifies a column or a set <strong>of</strong> columns in one (referencing) table that refers to set <strong>of</strong> columns in another (referenced)<br />

table. The columns in the referencing table must be the primary key or other candidate key in the referenced table.<br />

The values in one row <strong>of</strong> the referencing columns must occur in a single row in the referenced table. Thus, a row in<br />

the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL). This<br />

way references can be made to link information together and it is an essential part <strong>of</strong> database normalization.<br />

Multiple rows in the referencing table may refer to the same row in the referenced table. Most <strong>of</strong> the time, it reflects<br />

the one (master table, or referenced table) to many (child table, or referencing table) relationship.<br />

The referencing and referenced table may be the same table, i.e. the foreign key refers back to the same table. Such a<br />

foreign key is known in <strong>SQL</strong>:2003 as a self-referencing or recursive foreign key.<br />

A table may have multiple foreign keys, and each foreign key can have a different referenced table. Each foreign key<br />

is enforced independently by the database system. Therefore, cascading relationships between tables can be<br />

established using foreign keys.<br />

Improper foreign key/primary key relationships or not enforcing those relationships are <strong>of</strong>ten the source <strong>of</strong> many<br />

database and data modeling problems.<br />

Defining Foreign Keys<br />

Foreign keys are defined in the ANSI <strong>SQL</strong> Standard, through a FOREIGN KEY constraint. The syntax to add such a<br />

constraint to an existing table is defined in <strong>SQL</strong>:2003 as shown below. Omitting the column list in the<br />

REFERENCES clause implies that the foreign key shall reference the primary key <strong>of</strong> the referenced table.<br />

ALTER TABLE <br />

ADD [ CONSTRAINT ]<br />

FOREIGN KEY ( {, }... )<br />

REFERENCES [ ( {, }... )<br />

[ ON UPDATE ]<br />

[ ON DELETE ]<br />

Likewise, foreign keys can be defined as part <strong>of</strong> the CREATE TABLE <strong>SQL</strong> statement.<br />

CREATE TABLE table_name (<br />

id INTEGER PRIMARY KEY,<br />

col2 CHARACTER VARYING(20),<br />

col3 INTEGER,<br />

...

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!