Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
MySQL - a score of things to remember

From the initial raw mass of data through to a fully functional database application .... a long road with many things to learn. I've run two short MySQL courses this week, including some coverage of how to access the data they contain from PHP based web pages and I never cease to amaze myself at how many topics crop up as "must cover before we finish" subjects. I have a habit of writing such topics on the whiteboard during the course so that nothing gets forgotten, and I'm going to share the topics that were on the board yesterday with you to give you an idea of just how wide ranging they are.

My illustrations for this entry are from Bristol Blue Glass and show the first and last stages in the manufacturing process of a glass cat - from the first ball of molten glass to the addition of the stand.

So - what MySQL subjects did I have on my "Must Remember" list on this most recent course?

Load. How to load data that's supplied in the form of text files - perhaps tab or comma separated, and perhaps with various fields encased in quotes, into database tables. The Insert command is great for data for transactions once a system is live, but can be less than ideal for an initial population of tables with heritage data.

Dump. Backups of a database are vital - and it's vital you know how to take backups (and to ensure you know how to reload the data too if you need to, but that's another story)

Join. The linking of data that's held in more than one table in order to produce a human-readable view / report. It's also important to know how to join tables based on the contents of a particular field, and how to generate a report that tells you about orphan records in one or other table - records that won't join with just a regular join and can become lost in the system.

Order. If you select from a database, chances are you'll get more than one row in your result set - sometimes a lot more. How do you control the sequence in which the records are returned by your query (i.e. how do you sort your results?)

sc6. OK - I admit it, that's an internal code and it's not obvious what I mean by it. It's all to do with PHP programming, though, and ensuring that the programs you write in order to maintain and examine the data base are easy to maintain and robust in operation. It leads me somewhat off the MySQL topics and onto PHP, using a design model that keeps the HTML apart from the business logic, and the structure of the application apart from the "web helper" functions.

Security. Log in to a MySQL database by user name and password, and you'll find that your access rights may also be controlled by the name / IP address of the system that you're seated at. You'll be set up so that there's a whole lot of things you can do over the whole environment managed by MySQL - anything from being allowed to select records through to shutting down the server. And in addition you may be given some rights over individual databases. The further rights "per table" and finally yet more rights "per column". It's vital for the MySQL DBA (Database Administrator) who's setting these up to understand what's what in order that security is not compromised.

Table Types. Know your MyISAMs from your heaps from you InnoDb tables. Do you need transaction processing capabilities? Will table locking suffice for your needs or do you need to choose a table type with row locking?

Codd / Normalise. Codd's principles of database normalisation should be given due weight when you design a database. By ensuring that data doesn't repeat itself, that calculated data is not stored, and that no attempt is made to place two values into a single cell, you'll set yourself up for a robust, long lived and maintainable system even though it might make the tables appear to be pretty unreadable to the human eye at first.

my.cnf. Default settings for the MySQL daemon and clients can be set up so that individual users don't have to type in long access strings including host and login names each time they want to access their "home" server.

pivot tables. Where there's a many to many mapping to be defined between two tables, best design principles lead you to create a third table known as a link or pivot table.

denormalise. Having taught you how to normalise data, you may then decide that you can go one step beyond that and denormalise it. As long as you know your update rules and think things through very clearly, there can be benefits in denormalising. For example, keep a copy of the current month's data in a "now" table as well as storing the historic data in the main table, or breaking rows across two tables if you have a rarely-required column that account for the majority of the row content.

timeouts. How to handle large / complex queries from a web front end, where browsers and user's patience is likely to time out before the query is completed.

Where to select and sort If you're front ending a MySQL enquiry system through PHP, do you do your selection and sorting of data in the database, in the program, or do you use a combination?

Special Characters. Make sure that special characters such as " and ' and < entered into forms cannot be used to perform injection attacks on the database ... and that they display properly back to the browser when passed from form to variable, variable to table cell, table cell to variable, and back to the browser as part of the HTML response.

Last Insert ID. How to ensure that new data you add into your tables will join correctly between the tables - finding the automatically generated key and making use of it.

Upgrade - PHP4 to 5 and MySQL4 to 5. The new password security model in MySQL 4.1 that means that old clients may refuse to connect, and what you can do about it. The new mysqli functions in PHP5, and the unbundling of current MySQL drivers at that release. Things to be aware of in your coding and upgrade plans to make sure that what works on the systems you have today will upgrade easily to the systems you will have tomorrow.

(written 2005-11-12, updated 2006-06-05)

Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
S159 - MySQL 5 and PHP 5
  [104] mysql_connect or mysql_pconnect in PHP? - (2004-10-30)
  [515] MySQL - an FAQ - (2005-12-03)
  [1131] MySQL - Password security (authentication protocol) - (2007-04-02)
  [1417] What software version do we teach? - (2007-10-31)
  [1455] Connecting to MySQL 5 from PHP on Mac OSX Leopard - (2007-12-03)
  [1754] Upgrade from PHP 4 to PHP 5 - the TRY issue - (2008-08-15)
  [1766] Diagrams to show you how - Tomcat, Java, PHP - (2008-08-22)
  [2172] PHP4 v PHP5 - Object Model Difference - (2009-05-11)
  [3455] MySQL, MySQLi, PDO or something else - how best to talk to databases from PHP - (2011-09-24)

S157 - More MySQL commands
  [158] MySQL - LEFT JOIN and RIGHT JOIN, INNER JOIN and OUTER JOIN - (2004-12-20)
  [159] MySQL - Optimising Selects - (2004-12-21)
  [279] Getting a list of unique values from a MySQL column - (2005-04-14)
  [449] Matching in MySQL - (2005-09-24)
  [502] SELECT in MySQL - choosing the rows you want - (2005-11-22)
  [513] MySQL - JOIN or WHERE to link tables correctly? - (2005-12-01)
  [517] An occasional chance, and reducing data to manageable levels - (2005-12-04)
  [567] Combining similar rows from a MySQL database select - (2006-01-17)
  [572] Giving the researcher power over database analysis - (2006-01-22)
  [581] Saving a MySQL query results to your local disc for Excel - (2006-01-29)
  [591] Key facts - SQL and MySQL - (2006-02-04)
  [673] Helicopter views and tartans - (2006-04-06)
  [1213] MySQL - the order of clauses and the order of actions - (2007-06-01)
  [1235] Outputting numbers as words - MySQL with Perl or PHP - (2007-06-17)
  [1331] MySQL joins revisited - (2007-09-03)
  [1574] Joining MySQL tables revisited - finding nonmatching records, etc - (2008-03-15)
  [1735] Finding words and work boundaries (MySQL, Perl, PHP) - (2008-08-03)
  [1904] Ruby, Perl, Linux, MySQL - some training notes - (2008-11-23)
  [2110] MySQL - looking for records in one table that do NOT correspond to records in another table - (2009-03-31)
  [2259] Grouping rows for a summary report - MySQL and PHP - (2009-06-27)
  [2448] MySQL - efficiency and other topics - (2009-10-10)
  [2643] Relating tables with joins in MySQL - (2010-02-21)
  [2644] Counting rows in joined MySQL tables - (2010-02-22)
  [2645] Optimising and caching your MySQL enquiries - (2010-02-22)
  [2647] Removing duplicates from a MySQL table - (2010-02-22)
  [3061] Databases - why data is split into separate tables, and how to join them - (2010-11-20)
  [3270] SQL - Data v Metadata, and the various stages of data selection - (2011-04-29)
  [4481] Extracting data from backups to restore selected rows from MySQL tables - (2015-05-01)

S154 - MySQL - Designing an SQL Database System
  [59] MySQL - Pivot tables - (2004-09-22)
  [361] Binary Large Objects or bars - (2005-06-27)
  [375] Oops - I got my initial database design wrong - (2005-07-12)
  [666] Database design - get it right from first principles - (2006-04-02)
  [918] Databases needn't be frightening, hard or expensive - (2006-11-08)
  [937] Display an image from a MySQL database in a web page via PHP - (2006-11-22)
  [945] Code quality counts - (2006-11-26)
  [1423] MySQL - table design and initial testing example - (2007-11-06)
  [1575] Database design for a shopping application (MySQL) - (2008-03-15)
  [1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
  [2053] What a difference a MySQL Index made - (2009-02-25)
  [2085] MySQL - licensing issues, even with using the name - (2009-03-16)
  [2204] Images in a database? How big is a database? (MySQL) - (2009-05-28)
  [2749] Delegate Question - defining MySQL table relationships as you create the tables - (2010-05-02)
  [3361] Blowing our own trumpet - MySQL resources - (2011-07-18)
  [3494] Databases - when to treat the rules as guidelines - (2011-10-23)
  [4426] FileMaker Day to Unix Time conversion - (2015-02-15)

S152 - SQL Primer as Used in MySQL
  [270] NULL in MySQL - (2005-04-06)
  [2240] How do I query a database (MySQL)? - (2009-06-15)
  [3060] INSERT, DELETE, REPLACE and UPDATE - changing the content of SQL tables - (2010-11-19)
  [4007] Which database should I use? MySQL v SQLite - (2013-02-16)

Back to
Running a Perl script within a PHP page
Previous and next
Horse's mouth home
Forward to
More spam - a success story
Some other Articles
Why is Tomcat called Tomcat?
I have a river to cross
Python printf
More spam - a success story
MySQL - a score of things to remember
Running a Perl script within a PHP page
New Navigation Aid - Launch of My Wellho
Being atypical is typical
A new way to get lost
Which MySQL server am I using?
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page

This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/494_MySQ ... ember.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb