Previous Lecture Potential problems with Lists – Deletion – Update – Insertion Avoid these problems using a relational database: – Break a list into several tables, one table for each theme – Tables can be joined together using the value of the data
Exercise IST2105 What are the problems with this table. Split it into multiple tables. Check whether you split the table correctly.
Relational Databases A relational database stores information in tables. Each informational topic is stored in its own table In essence, a relational database will break-up a list into several parts. One part for each theme in the list IST2106
Answering Query: Putting the Pieces Back Together In our relational database, we broke apart our list into several tables. Somehow the tables must be joined back together In a relational database, tables are joined together using the value of the data IST2107
Query Relational Database: Using One Table IST2108 Student Table Course Table Registration Table Query 1: How many students take class 210? Answer: Check Registration Table to see many rows with CourseID as 210. count = 4
Query Relational Database: Using Two Tables IST2109 Query 2: How many students take class taught by Marc? Student Table Course Table Registration Table Answer: Step 1. Check the CourseID taught by David in Course Table. CourseID = 220 Step 2. See how many students taking class with CourseID 220 in Registration Table. count = 2
Query Relational Database: Using Three Tables IST21010 Query 3: Who are the students taking class taught by Zihan? Student Table Course Table Registration Table Answer: Step 1. Check the CourseID taught by Zihan in Course Table. CourseID = 210 Step 2. Get the StudentID taking class with CourseID 210 in Registration Table. StudentID 101, 102, 103, 104 Step 3. Get the student names in Student Table with StudentID 101, 102, 103, 104. Bob, Lisa, Sarah, Jim
Query Relational Database IST21011 Student Table Course Table Registration Table In a relational database, to answer a query, tables are joined together using the value of the data in the shared columns
Query Relational Database: Structured Query Language (SQL) Structured Query Language (SQL) is an international standard for creating, processing and querying databases and their tables IST21012 SELECTCount(StudentID) FROMCourse, Registration WHERECourse.CourseID = Registration.CourseID AND Course.Instructor = Marc Query 2: How many students take class taught by John? Answer: Step 1. Check the CourseID taught by Marc in Course Table. CourseID = 220 Step 2. See how many students taking class with CourseID 220 in Registration Table. count = 2
Exercise (cont.) IST21013 After you split this table into multiple tables, answer following questions: Question 1: How many items purchased by Anderson? Question 2: What items purchased by customers in State College?
Sounds like More Work, Not Less A relational database is more complicated than a list However, a relational database minimizes data redundancy, preserves complex relationships among topics, and allows for partial data Furthermore, a relational database provides a solid foundation for user forms and reports IST21014
Chapter 1 Summary What is the problem with using a simple list to store the information? – Redundancy, Multiple themes Modification issues What is the solution to replace a simple list? – Relational database – Break a simple long list to several tables; each table has its own theme How to query a relational database? – Join back the tables by the value of data through shared columns IST21015
Keep In Mind This is not a programming course! Programming can be time consuming. Plan ahead!
HTML: Hyper Text Markup Language An HTML document is a text file (script) A web browser (IE, Firefox, Opera, etc.) interprets the script and presents appropriate contents 18IST210
Tags in HTML Tags are mainly used to indicate what data is about and for some types of data, how to display it – Document properties – Layout – Text style – Images – Hyper-links 19IST210
Basic Tags Four Basic tags – HTML – Head – Title – Body 20IST210 Hello World Hello World!
Try it yourself Start Notepad Create an HTML document with all four basic tags – HTML – HEAD – TITLE – BODY Save as an html document, e.g. HelloWorld.html – Remember to change Save as type to All Files. It will be saved as.txt by default. To display: Double click or open in a web browser Hello World Hello World! 21IST210
HTML Tags: Format Format tags: – Container tags Affect whatever part of the document they contain – bold tag: text – italic tag: text texts – font tag: text – Singular tag Results in an action where the tag is located in the HTML – the horizontal line tag: – line break line tag: 22IST210
Try it yourself bold tag: text line break line tag: font tag: text Hello World Hello World! My name is Zihan. How are you?
HTML Tags: More Text Styles Regular bold Regular big Regular emphasized Regular italic Regular small Regular strong Regular subscripted Regular superscripted Regular inserted Regular deleted You are NOT required to remember all of them 24IST210
HTML Tags: More Fonts Font is defined by tag, with the following attributes: – size="number" size="2" Defines the font size – size="+number" size="+1" Increases the font size – size="-number" size="-1" Decreases the font size – face="face-name" face="Times" Defines the font-name – color="color-value" color="#FFFFFF" Defines the font color – color="color-name" color="red" Defines the font color Regular size=2 size=+2 size=-2 Arial Green Red 25IST210 attributevalue
HTML Tags: Heading Heading tags: to, where is the largest. A blank line is added before/after the heading. Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 Heading 6 Regular text 26IST210
Document Attribute IST21027 Hello World Hello World! text
HTML Tags: Document Attributes Background color RGB colors HTML colors are defined using a hexadecimal notation for the combination of Red, Green, and Blue color values (RGB). The lowest value that can be given to one of the light sources is 0 (hex #00). The highest value is 255 (hex #FF). http://www.w3schools.com/HTML/html_colornames.asp Background image 28IST210
HTML Tags: More… More tags: – http://www.w3schools.com/tags/default.asp http://www.w3schools.com/tags/default.asp HTML is not case sensitive, but lower case tags are suggested Coding in HTML is not as strict as in programming languages You can use html or htm as file extension Try view page source on any webpage – On a webpage, right click, click on View Source IST21029
Place Your Page on Web Access your IST web space – Method 1: – Method 2: Direct access via UNC path: \\upws1.up.ist.local\Users\USERNAMEUNC path The URL for your web space is: http://my.up.ist.psu.edu/USERNAME/helloworld.html IST21030
Lab Exercise Time and Location – 2:30 – 3:45 PM Thursday – Location: 202 IST Building A Simple Personal Webpage – Use the HTML basics you learnt in class to make your homepage and place it on the web – See the next slide for requirements – If you meet every checkpoint in requirements, let TA take a look and mark your lab attendance 31IST210
1. Access your webpage from web 2. Use your name as the page title 7. Use yellow background color 6. Hobby in color blue, font Arial, and italic 3. Welcome line in heading 4. Major in red color 5. Year in font size 8
Your consent to our cookies if you continue to use this website.