Hack hack hack...

An open journal-- some of it written for you, but most of it is for me.

FIS Day2

summary of yesterday plan for today

-everyone should be cloning on their own

git clone create new repo - git remove remote origin - git add remote origin

make changes push to our repo submit pull request to flatiron repo

DB design:

student:

id (pk, incrementer)
name

Quiz:

id (pk, incrementer)
a question
b question
c question
d question
e queston
answer

Student/answers

student id
quiz id

circles for pictures css - mask transparent circle on top of it

write a site that degrades gracefully. progressive enhancement- don’t build for the worst browser rather than the worst

Smilies implementation
1
2
3
4
5
/* in the css */
div smilies-5{
  width: 300px;
  background: repeat-x url(smilies)
}

communicate on the web protocols ssh http http git:// ftp aim://

https required more resources // => piggy back the protocol that is being used. over course if this is local it will break on the file system

tr;dl => too long, don’t read

Programmer of the day Edgar F. Codd: designed the relational database model

  • relational model: has data with keys one column has a primary key and all the other data works off of that primary
  • don’t want to repeat data so you a second normal form is what you want over third normal form. network model

  • Hierarchical model is the other kind, that no one uses

“A relation is in second normal form if the relation depends on the key, the whole key, and nothing but the key, so help me Codd.”source

Beautiful code- is in proportion to the complexity of the problem.

left joins, inner joins, etc.

Prefixes
1
2
3
4
//prefix. It would be ambiguous if you had the content column in
SELECT question.content multiple tables
FROM quiz, question, quiz_question
WHERE

sql data types

The fewer tables you query, the more efficient the query is

difference between a where and a join

refernential integrity problem

Prefixes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
student
id         name
1         Adam Jonas

quiz
id         name
1             First quiz

question
id question_content                     correct_answer_id    quiz_id
1     "What's the color of the sky"         1                               1

answers
id         response_content         question_id
1         "blue"                                    1
2         "red"                                     1


student_answers
question_id    student_id       student_response_id  correct
    1                         1                           2

Different SQL JOINs

Before we continue with examples, we will list the types of JOIN you can use, and the differences between them.

JOIN: Return rows when there is at least one match in both tables (this is also known as inner join) LEFT JOIN: Return all rows from the left table, even if there are no matches in the right table RIGHT JOIN: Return all rows from the right table, even if there are no matches in the left table FULL JOIN: Return rows when there is a match in one of the tables

multiple row inserts syntax

Comments