SQL and relational databases
Relational databases are made of tables, which are made of many rows. Each row has data in each of several columns (every row in a table has the same columns). Different columns can have different types of data- mySQL supports a large variety of datatypes, in various flavors of int/float/char/date. SQL is the system used to retrieve data.
insert into tablename (col1,col2,col3,...) values (val1,val2,val3,..);
update tablename set col1=val1 where col2=val2;
The "where" clause can be much more complicated.
delete from tablename where col1=val1;
Again, the where clause can be very complicated.
select col1, col2, col3 from tablename where col4=val4;
Selects can be VERY complicated. They can span several tables, with where clauses linking the tables- spose we have two tables MODULE and STRIP. Module has a column for plane number and module id. STRIP has a column for the module its installed in, and a column for the pe yield at the end of the strip. I want to know what the pe yield is for all strips in plane 12- you could do it in two steps, or you could let the database do the work:
select a.peyield from STRIP a, MODULE b where a.moduleID= b.moduleID
This is a join, and joins have no limit on their complexity. Spose we have the same two tabels above, and a third of fiber tests. Each strip has an ID number for its fiber, and each spool of fiber has a test result. We want to know which planes have modules containin strips where the test number was less than 25:
select a.plane from MODULE a, STRIP b, FIBER_TEST c where
b.moduleID= a.moduleID and b.fiberID= c.fiberID
and c.testResult < 25;
But wait! There's more! Youc an also include functions pretty much anywhere:
select count(plane) from MODULE where ,,,,
select avg(testResult) from FIBER_TEST where testDate = date('2000-12-25');
select a.length*b.weight from STRIP a, STEEL_PLATE b, MODULE C where....