/
CGS 3066: Web Programming and Design CGS 3066: Web Programming and Design

CGS 3066: Web Programming and Design - PowerPoint Presentation

stingraycartier
stingraycartier . @stingraycartier
Follow
346 views
Uploaded On 2020-08-28

CGS 3066: Web Programming and Design - PPT Presentation

Fall 2019 More on SQL Primary Key A primary key is a special relational database table column or combination of columns designated to uniquely identify all table records A primary keys main features are ID: 809140

column table key primary table column primary key constraint unique database alter defined expression identifier index columns keya add

Share:

Link:

Embed:

Download Presentation from below link

Download The PPT/PDF document "CGS 3066: Web Programming and Design" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

CGS 3066: Web Programming and DesignFall 2019

More on SQL

Slide2

Primary KeyA primary key is a special relational database table column (or combination of columns) designated to uniquely identify all table records.A primary key’s main features are:It must contain a unique value for each row of data.It cannot contain null values.A primary key is either an existing table column or a column that is specifically generated by the database according to a defined sequence. (techopedia.com)

Slide3

Primary KeyPrimary keys can be defined when creating a table:CREATE TABLE table_name ( id_col

INT PRIMARY KEY, col2 CHARACTER VARYING(20), ... )Or can be defined using alter table query by adding constraint:ALTER TABLE <table identifier> ADD [ CONSTRAINT <constraint identifier> ] PRIMARY KEY ( <column expression> {, <column expression>}... )

Slide4

Foreign KeyA foreign key is a column or group of columns in a relational database table that provides a link between data in two tables. It acts as a cross-reference between tables because it references the primary key of another table, thereby establishing a link between them.(techopedia.com)

Slide5

Unique KeyA unique key is a set of one or more than one fields/columns of a table that uniquely identify a record in a database table.Unique keys can be defined when creating a table:CREATE TABLE table_name

( id_col INT PRIMARY KEY, col2 CHARACTER VARYING(20), ... identifier> ( <column expression> {, <column eUNIQUE INDEX <constraint xpression>}... ) )

Or can be defined using alter table query by adding constraint:

ALTER TABLE <table identifier>

ADD [ CONSTRAINT <constraint identifier> ]

UNIQUE INDEX( <column expression> {, <column expression>}... )

ALTER

TABLE

fruits

ADD

CONSTRAINT

uq_1

UNIQUE

INDEX

(`name`, color )

Slide6

HR Database

Slide7

Perform SQL Operations on Employee Databasehttps://www.w3resource.com/mysql-exercises/basic-simple-exercises/index.phpDisplay all employeesDisplay salaries of all employeesDisplay the unique job_ids

for the employeesDisplay IDs and names (first_name, last_name) using alias full_nameSelect names (first_name, last_name), salary, PF of all the employees (PF is calculated as 15% of salary)