Aplikime Te Bazave Te Te Dhenave 2
Aplikime Te Bazave Te Te Dhenave 2
Aplikime Te Bazave Te Te Dhenave 2
com
specify constraints
administer users, security, etc.
Creates the Students table. Note: the type (domain) of each field is specified, and enforced by the DBMS
whenever tuples are added or
CREATE TABLE Students (sid CHAR(20), name CHAR(20), login CHAR(10), age INTEGER, gpa FLOAT)
CREATE TABLE Enrolled (sid CHAR(20), Another example: the Enrolled cid CHAR(20), table holds information about grade CHAR(2))
modified.
Can delete all tuples satisfying some condition (e.g., name = Smith):
DELETE FROM Students S WHERE S.name = Smith
Enrolled
sid 53666 53666 53650 53666
Keys are a way to associate tuples in different relations Keys are one form of integrity constraint (IC)
cid grade Carnatic101 C Reggae203 B Topology112 A History105 B
Students
sid 53666 53688 53650 name login Jones jones@cs Smith smith@eecs Smith smith@math age 18 18 19 gpa 3.4 3.2 3.8
E.g. sid is a key for Students. What about name? The set {sid, gpa} is a superkey.
Enrolled
sid 53666 53666 53650 53666 cid grade Carnatic101 C Reggae203 B Topology112 A History105 B
Foreign key : Set of fields in one relation that is used to `refer to a tuple in another relation.
Must correspond to primary key of the second
Only students listed in the Students relation should be allowed to enroll for courses.
CREATE TABLE Enrolled (sid CHAR(20), cid CHAR(20), grade CHAR(2), PRIMARY KEY (sid,cid), FOREIGN KEY (sid) REFERENCES Students )
Enrolled
sid 53666 53666 53650 53666 cid grade Carnatic101 C Reggae203 B Topology112 A History105 B
Students
sid 53666 53688 53650 name login Jones jones@cs Smith smith@eecs Smith smith@math age 18 18 19 gpa 3.4 3.2 3.8
10
IC: condition that must be true for any instance of the database; e.g., domain constraints.
ICs are specified when schema is defined. ICs are checked when relations are modified.
If the DBMS checks ICs, stored data is more faithful to real-world meaning.
Avoids data entry errors, too!
11
Enrolled
sid 53666 53666 53650 53666 cid Carnatic101 Reggae203 Topology112 History105 grade C B A B
sid name login 53666 Jones jones@cs 53688 Smith smith@eecs 53650 Smith smith@math
Students
age 18 18 19
Remember Students and Enrolled; sid in Enrolled is a foreign key that references Students. What should be done if an Enrolled tuple with a non-existent student id is inserted?
(Reject it!)
Also delete all Enrolled tuples that refer to it. Disallow deletion of a Students tuple that is referred to. Set sid in Enrolled tuples that refer to it to a default sid. (In SQL, also: Set sid in Enrolled tuples that refer to it to a special value null, denoting `unknown or `inapplicable.)
12
13
we get:
Hyper Text Markup Language A markup language designed for the creation of web pages and other information viewable in a browser The basic language used to write web pages File extension: .htm, .html
1.
2.
3.
4.
5. 6.
Open Notepad Click on File -> Save as In the File name pull-down box, type in webpage.html Click on Save Type in content for your file Once you finished the content, click on File > Save
For example: <b>, <font>,<title>, <p> etc. Tag usually goes with pair: an open tag (<b>) and an end tag (<\b>)
Effect Bold Italic Code B I Code Used <B>Bold</B> <I>Italic</I> What It Does Bold Italic
Bgcolor Specifies a backgroundcolor for a HTML page. <body bgcolor="#000000"> <body bgcolor="rgb(0,0,0)"> <body bgcolor="black">
Background Specifies a backgroundimage for a HTML page <body background="clouds.gif"> <body background="http://www. w3schools.com/clouds.gif" >
Hello
Hello
Tag attribute
Using both
<font size=+3 color=red>Hello</font> Output:
Hello
Unordered list
Code:
Ordered list
<table border=1"> <tr> <th>Heading</th> <th>Another Heading</th> </tr> <tr> Heading <td>row 1, cell 1</td> <td>row 1, cell 2</td> Row 1, cell 1 </tr> Row 2, cell 1 <tr> <td>row 2, cell 1</td> <td></td> </tr> </table>
Another Heading
Row 1, cell 2
A Hypertext link
< a href=http://www.iusb.edu>IUSB Home</a> Output: IUSB Home
A Email link
<a href=mailto:[email protected]>
.gif
Graphics Interchange Format
.jpeg or .jpg
Joint Photographic Experts Group
.bmp
bitmap
Place all images in the same directory/folder where you web pages are <img src> is a single tag <img src=image.gif>
Output:
src=image.gif></a> Output:
Width
A form is an area that can contain form elements. <form></form> Commonly used form elements includes:
Text fields Radio buttons
Checkboxes
Submit buttons
Used when you want the user to type letters, number, etc. <form> First name: <input type="text" name="firstname"> <br> Last name: <input type="text" name="lastname"> </form>
Output
First name: Last name:
When user clicks on the Submit button, the content of the form is sent to another file. <form name="input" action="html_form_action .asp" method="get"> Username: <input type="text" name="user"> <br> <input type="submit" value="Submit"> </form>
Output
Username:
Used when you want the user to select one or more options of a limited number of choices. <form> <input type="checkbox" name="bike value=bike > I have a bike <br> <input type="checkbox" name="car value=car> I have a car </form>
Output
I have a bike I have a car
Used when you want the user to select one of a limited number of choices. <form> <input type="radio" name="sex" value="male"> Male <br> <input type="radio" name="sex" value="female"> Female </form>
Output
Male Female
Used when you want to get input from user. <form> <p>Please provide your suggestion in the text box below:</p> <textarea row=10 cols=30> </textarea> </form>
Used when you want user to respond with one specific answer with choices you given. <p>Select a fruit:</p> <select name"Fruit"> <option selected> Apples <option> Bananas < option > Oranges </select>