Deprecated: add_custom_background is deprecated since version 3.4.0! Use add_theme_support( 'custom-background', $args ) instead. in /home/pqmz7qzy9yt5/public_html/wp-includes/functions.php on line 5084

Deprecated: add_custom_image_header is deprecated since version 3.4.0! Use add_theme_support( 'custom-header', $args ) instead. in /home/pqmz7qzy9yt5/public_html/wp-includes/functions.php on line 5084

Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/pqmz7qzy9yt5/public_html/wp-includes/functions.php on line 5536

Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the smoothscroll handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/pqmz7qzy9yt5/public_html/wp-includes/functions.php on line 5536

Deprecated: The called constructor method for WP_Widget in Yoko_SocialLinks_Widget is deprecated since version 4.3.0! Use __construct() instead. in /home/pqmz7qzy9yt5/public_html/wp-includes/functions.php on line 5177
Intro to Databases: Constraints and Triggers, Constraints of several types | Megan Taylor

Megan Taylor

front-end dev, volunteacher, news & data junkie, bibliophile, Flyers fan, sci-fi geek and kitteh servant

Intro to Databases: Constraints and Triggers, Constraints of several types

Non-null
Key
Attribute-based
Tuple-based
General assertions

College(cName, state, enrollment)
Student(sID, sName, GPA, sizeHS)
Apply(sID, cName, major, decision)

create table Student(sID int, sName text, GPA real not null, sizeHS int);

create table Student(sID int primary key, sName text, GPA real, sizeHS int);

create table Student(sID int primary key, sName text unique, GPA real, sizeHS int);

create table College(cName text, state text, enrollment int, primary key (cName, state));

create table Apply(sID int, cName text, major text, decision text, unique (sID, cName), unique(sID, major));

create table Student(sID int, sName text, GPA real check(GPA <= 4.0 and GPA > 0.0), sizeHS int check(sizeHS < 5000)); create table Apply(sID int, cName text, major text, decision text, check(decision = 'N' or cName <> ‘Stanford’ or major <> ‘CS’));

create table Student(sID int, sName text, GPA real check(GPA is not null), sizeHS int);

create table T(A int check(A not in (select A from T)));
error – declare a table and refer to it before its been declared, sub check in check constraint

create table T(A int check((select count(distinct A) from T) = (select count(*) from T)));
error – declare a table and refer to it before its been declared
no subqueries or aggregation in check constraints

November 28, 2011 | Comments Off on Intro to Databases: Constraints and Triggers, Constraints of several types | Categories: Posts | Permalink

Comments are closed.


Notice: Undefined index: host in /home/pqmz7qzy9yt5/public_html/wp-content/plugins/jetpack/modules/stats.php on line 209