Help:COAP-3180/week3: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
m (Created page with '== Week 3 - COAP 3180 == === Topics Covered === '''Portalware configuration''' (continued): * discussion of homework 2 if needed '''Relational databases: …')
 
Line 17: Line 17:
* Learn how to inject SQL code in MySQL Admin (a web application to administer web databases) in order to create databases and tables
* Learn how to inject SQL code in MySQL Admin (a web application to administer web databases) in order to create databases and tables
* Create a simple 1-table MySQL database with the database administration tool
* Create a simple 1-table MySQL database with the database administration tool
* [[Help:COAP-3180/hw3|homework 3]]
 
== Play time ==
 
'''Warning'''. Be careful with quotes and double quotes.
* Quotes must be straight (same for double quotes).
<pre>
'  = Ok
’  = BAD !!!
</pre>
... So use a real text editor and '''not''' a word processor.
 
 
; (1) Demo 1 example
<pre>
 
CREATE TABLE demo1 (
  id int(10) NOT NULL auto_increment,
  login char(10) DEFAULT '' NOT NULL,
  password char(100),
  fullname char(40) DEFAULT '' NOT NULL,
  url char(60) DEFAULT '' NOT NULL,
  food int(11) DEFAULT '0' NOT NULL,
  work int(11) DEFAULT '0' NOT NULL,
  love int(11) DEFAULT '0' NOT NULL,
  leisure int(11) DEFAULT '0' NOT NULL,
  sports int(11) DEFAULT '0' NOT NULL,
  PRIMARY KEY (id),
  KEY login (login)
);
 
</pre>
 
;(2) Student database with 2 tables
 
<pre>
 
DROP TABLE IF EXISTS student;
DROP TABLE IF EXISTS exercise;
 
CREATE TABLE student (
  id int(10) NOT NULL auto_increment,
  name char(40) DEFAULT '' NOT NULL,
  first_name char(40) DEFAULT '' NOT NULL,
  PRIMARY KEY (id)
);
 
INSERT INTO student VALUES (NULL,'Testeur','Bill');
INSERT INTO student VALUES (NULL,'Testeur','Joe');
INSERT INTO student VALUES (NULL,'Testeuse','Sophie');
 
CREATE TABLE exercise (
  id int(10) NOT NULL auto_increment,
  title char(40) DEFAULT '' NOT NULL,
  student_id int(10) NOT NULL,
  comments varchar(128),
  url char(60) DEFAULT '' NOT NULL,
  PRIMARY KEY (id),
  KEY student_id (student_id)
);
 
INSERT INTO exercise VALUES (NULL,"Exercise 1",'1',"small comment",'http://tecfa.unige.ch/');
INSERT INTO exercise VALUES (NULL,"Exercise 2",'1',"no comment",'http://tecfa.unige.ch/');
 
</pre>


=== Classroom activities Wednesday ===
=== Classroom activities Wednesday ===

Revision as of 01:15, 25 January 2010

Week 3 - COAP 3180

Topics Covered

Portalware configuration (continued):

  • discussion of homework 2 if needed

Relational databases: Introduction to SQL (part 1):

  • Relational tables (principles)
  • Retrieving data
  • Definition of SQL tables and use of the phpMySQL tool

Classroom activities Monday

  • Define a table with SQL code
  • Learn how to inject SQL code in MySQL Admin (a web application to administer web databases) in order to create databases and tables
  • Create a simple 1-table MySQL database with the database administration tool

Play time

Warning. Be careful with quotes and double quotes.

  • Quotes must be straight (same for double quotes).
 '  = Ok
 ’  = BAD !!!

... So use a real text editor and not a word processor.


(1) Demo 1 example

CREATE TABLE demo1 (
  id int(10) NOT NULL auto_increment,
  login char(10) DEFAULT '' NOT NULL,
  password char(100),
  fullname char(40) DEFAULT '' NOT NULL,
  url char(60) DEFAULT '' NOT NULL,
  food int(11) DEFAULT '0' NOT NULL,
  work int(11) DEFAULT '0' NOT NULL,
  love int(11) DEFAULT '0' NOT NULL,
  leisure int(11) DEFAULT '0' NOT NULL,
  sports int(11) DEFAULT '0' NOT NULL,
  PRIMARY KEY (id),
  KEY login (login)
);

(2) Student database with 2 tables

DROP TABLE IF EXISTS student;
DROP TABLE IF EXISTS exercise;

CREATE TABLE student (
  id int(10) NOT NULL auto_increment,
  name char(40) DEFAULT '' NOT NULL,
  first_name char(40) DEFAULT '' NOT NULL,
  PRIMARY KEY (id)
);

INSERT INTO student VALUES (NULL,'Testeur','Bill');
INSERT INTO student VALUES (NULL,'Testeur','Joe');
INSERT INTO student VALUES (NULL,'Testeuse','Sophie');

CREATE TABLE exercise (
  id int(10) NOT NULL auto_increment,
  title char(40) DEFAULT '' NOT NULL,
  student_id int(10) NOT NULL,
  comments varchar(128),
  url char(60) DEFAULT '' NOT NULL,
  PRIMARY KEY (id),
  KEY student_id (student_id)
);

INSERT INTO exercise VALUES (NULL,"Exercise 1",'1',"small comment",'http://tecfa.unige.ch/');
INSERT INTO exercise VALUES (NULL,"Exercise 2",'1',"no comment",'http://tecfa.unige.ch/');

Classroom activities Wednesday

  • Relational databases
  • web hosting
  • The anatomy of Wordpress

Homework X

Topic: Database definition (2-3 tables), Details to be announced on Wednesday.

Submission Dates

  • This homework is due at start of wed week 4
  • Students must upload an SQL file to the worldclassroom. The file must include some documentation
  • Each homework counts 10% in your global evaluation. The four best homeworks will be taken into account.

Evaluation

TBA

Tips for the homework

Links and teaching materials

Online software


Teaching materials (slides and reading)

You probably will have to complete my lecture notes with extra reading. Pick one of the following. (Unfortunatel, some of these articles are presented as multiple pages ....)