Lecture 16: SQL and HTML tables

Slides:



Advertisements
Similar presentations
HTML TABLES EXPLAINED. What is a TABLE? The HTML table allows web designers to arrange & organize data -- text, images, hyperlinks, forms, form fields,
Advertisements

INTRODUCTORY Tutorial 8 Creating Data Tables. XP Objectives Contrast data tables with layout tables Create a table to display and organize data Provide.
Use Tables for Layout Control Day 7. You will learn to: Understand Tables Create a Simple Table Modify Your Tables Appearance Create Page Layouts with.
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything Text Lists Other tables Pictures …
Layout using CSS. Using multiple classes In the head:.important{font-style:italic;}.title{color:red;} In the body: Here's a type of paragraph that is.
Web Design HTML Basic Robertus Setiawan Aji Nugroho References: w3schools.com.
Introducing Web Tables
HTML. Goals How to use the Komodo editor HTML coding and testing Basic HTML tags List and Images Tables and Links At least 2 pages and navigation
HTML. Creating a Table Attributes: border: indicates the border type of the table Value: 0 (no border), 1, 2, etc. cols: indicates the number of columns.
1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 06: Tables - Spring 2011.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 8 Key Concepts 1 Copyright © Terry Felke-Morris.
Tutorial #8 – Creating Data Tables. Tutorial #6 Review – Layouts Two Column Fixed Width, Three Column Fixed Width Class VS. ID Container Universal Selector.
CIS 1310 – HTML & CSS 8 Tables. CIS 1310 – HTML & CSS Learning Outcomes  Create a Table  Apply Attributes to Format Tables  Increase the Accessibility.
Database Basics CS Why use a database?  powerful: can search it, filter data, combine data from multiple sources  fast: can search/filter a database.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorial 5: Working with Tables.
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
Appendix A Database Design CS Database design principles  database design: the act of deciding the schema for a database  database schema: a description.
INTRODUCTORY Tutorial 7 Creating Tables. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Discern the difference between data tables and.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
Principles of Web Design 6 th Edition Chapter 10 – Data Tables.
Tables Learning Web Design: Chapter 8. Overview of Tables Uses for tables How to create a table Using CSS to style a table Nested tables Advanced table.
CHAPTER 10 Formatting Tables and Forms. Using Tables the Right Way  HTML and XHTML have a LOT of tags dedicated to building a table  If you have only.
>> Introduction to HTML: Tables. HTML is used to give websites structure 5 Basic Tags Element = Start-Tag+Content+End-Tag Heading Tags [h1-h6] Paragraph.
Example simpsons database
Designing a Web Page with Tables. A text table: contains only text, evenly spaced on the Web page in rows and columns uses only standard word processing.
Chapter 9 Table Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Basics of Web Design 1 Copyright © 2016 Pearson Education, Inc., Hoboken NJ.
Tutorial 5 Working with Tables and Columns
Web Development & Design Foundations with XHTML Chapter 8 Key Concepts.
Tutorial 5 Working with Tables and Columns
CSS Table Properties.
Html Tables Basic Table Markup. How Tables are Used For Data Display Tables were originally designed to display and organize tabular data (charts, statistics,
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
CSE 154 LECTURE 14: MULTI-TABLE SQL QUERIES (JOINS)
Tutorial 5: Tables Session OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.
1 TECH1001 Lecture 6 Electronic Publishing and Production 1 More About Tables.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 8 Key Concepts 1 Copyright © Terry Felke-Morris.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything › Text › Lists › Other tables › Pictures › …
Tables with XHTML Please use speaker notes for additional information!
CIS234A Lecture 8 Instructor Greg D’Andrea. Review Text Table contains only text, evenly spaced on the Web page in rows and columns uses only standard.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 8 Key Concepts 1 Copyright © Terry Felke-Morris.
26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No.
How To Create HTML Tables. Table Structure General HTML code for a Web Table: table cells table cells.
Assistant Professor,UCER Naini,Allahabad
Chapter 9 Table Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
©SoftMoore ConsultingSlide 1 Introduction to HTML: Block-Level Elements.
Tutorial 5: Tables Session OBJECTIVES Create a table Insert a table summary Insert a table caption Add rows and cells Merge Cells inside a Table.
Copyright © 2012 Certification Partners, LLC -- All Rights Reserved Lesson 5: HTML Tables.
Tables creating a table within a web page. What makes up a table? Columns Rows.
CSS Table Styling. Up to this point, as we haven't applied any CSS styling to our tables, our example tables have not been too pleasing to the eye. CSS.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 5.
Tables.  How tables are used  Basic table structure  Importance of headers  Spanning rows and columns  Cell padding and spacing  Accessibility.
Tutorial 5 Working with Web Tables. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Learn and Apply the structure of.
INTRODUCTION ABOUT DIV Most websites have put their content in multiple columns. Multiple columns are created by using or elements. The div element is.
CSS for Styling By Jinzhu Gao.
CSE 154 Lecture 17: HTML tables.
Organizing Content with Lists and Tables
Working with Tables: Module A: Table Basics
>> HTML: Tables.
HTML Tables CS 1150 Spring 2017.
Chapter 7 Tables.
8 Tables.
Lecture 25: SQL and HTML tables
Lecture 23: Multi-table SQL Queries (Joins)
Using tables in HTML Goes in order with Examples at my site.
Principles of Web Design 5th Edition
Lesson 5: HTML Tables.
Lecture 21: Multi-table SQL Queries (Joins)
Presentation transcript:

Lecture 16: SQL and HTML tables CSE 154 Lecture 16: SQL and HTML tables

Practice queries What are the names of all teachers Bart has had? SELECT DISTINCT t.name FROM teachers t JOIN courses c ON c.teacher_id = t.id JOIN grades g ON g.course_id = c.id JOIN students s ON s.id = g.student_id WHERE s.name = 'Bart'; SQL How many total students has Ms. Krabappel taught, and what are their names? SELECT DISTINCT s.name FROM students s JOIN grades g ON s.id = g.student_id JOIN courses c ON g.course_id = c.id JOIN teachers t ON t.id = c.teacher_id WHERE t.name = 'Krabappel'; SQL

HTML tables: <table>, <tr>, <td> A 2D table of rows and columns of data (block element) <table> <tr><td>1,1</td><td>1,2 okay</td></tr> <tr><td>2,1 real wide</td><td>2,2</td></tr> </table> HTML 1,1 1,2 okay 2,1 real wide 2,2 output table defines the overall table, tr each row, and td each cell's data tables are useful for displaying large row/column data sets NOTE: tables are sometimes used by novices for web page layout, but this is not proper semantic HTML and should be avoided

Table headers, captions: <th>, <caption> <caption>My important data</caption> <tr><th>Column 1</th><th>Column 2</th></tr> <tr><td>1,1</td><td>1,2 okay</td></tr> <tr><td>2,1 real wide</td><td>2,2</td></tr> </table> HTML output My important data Column 1 Column 2 1,1 1,2 okay 2,1 real wide 2,2 th cells in a row are considered headers; by default, they appear bold a caption at the start of the table labels its meaning

Styling tables table { border: 2px solid black; caption-side: bottom; } tr { font-style: italic; } td { background-color: yellow; text-align: center; width: 30%; } output Column 1 Column 2 1,1 1,2 okay 2,1 real wide 2,2 My important data all standard CSS styles can be applied to a table, row, or cell table specific CSS properties: border-collapse, border-spacing, caption-side, empty-cells, table-layout

The border-collapse property table, td, th { border: 2px solid black; } table { border-collapse: collapse; } CSS With border-collapse Column 1 Column 2 1,1 1,2 2,1 2,2 by default, the overall table has a separate border from each cell inside the border-collapse property merges these borders into one

The rowspan and colspan attributes <table> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> <tr><td colspan="2">1,1-1,2</td> <td rowspan="3">1,3-3,3</td></tr> <tr><td>2,1</td><td>2,2</td></tr> <tr><td>3,1</td><td>3,2</td></tr> </table> HTML HTML Column 1 Column 2 Column 3 1,1-1,2 1,3-3,3 2,1 2,2 3,1 3,2 colspan makes a cell occupy multiple columns; rowspan multiple rows text-align and vertical-align control where the text appears within a cell

Column styles: <col>, <colgroup> <table> <col class="urgent" /> <colgroup class="highlight" span="2"></colgroup> <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> <tr><td>1,1</td><td>1,2</td><td>1,3</td></tr> <tr><td>2,1</td><td>2,2</td><td>2,3</td></tr> </table> HTML output Column 1 Column 2 Column 3 1,1 1,2 1,3 2,1 2,2 2,3 col tag can be used to define styles that apply to an entire column (self-closing) colgroup tag applies a style to a group of columns (NOT self-closing

Don't use tables for layout! (borderless) tables appear to be an easy way to achieve grid-like page layouts many "newbie" web pages do this (including many UW CSE web pages...) but, a table has semantics; it should be used only to represent an actual table of data instead of tables, use divs, widths/margins, floats, etc. to perform layout tables should not be used for layout! tables should not be used for layout!! TABLES SHOULD NOT BE USED FOR LAYOUT!!! TABLES SHOULD NOT BE USED FOR LAYOUT!!!!

Designing a query Figure out the proper SQL queries in the following way: Which table(s) contain the critical data? (FROM) Which columns do I need in the result set? (SELECT) How are tables connected (JOIN) and values filtered (WHERE)? Test on a small data set (imdb_small). Confirm on the real data set (imdb). Try out the queries first in the MySQL console. Write the PHP code to run those same queries. Make sure to check for SQL errors at every step!!