| |||||||||||
| |||||||||||
Key facts - SQL and MySQL
Some quick ways to remember your SQL; here are some "flashbulb moments" for newcomers and occasional users of MySQL and other SQL databases.
A database daemon is a process that looks after a number of DATABASES each of which comprises a number of TABLES each of which comprises data arranges in ROWS and COLUMNS. You don't access database information directly on the disc from any application program - you access it via your database daemon (a program called mysqld) which is usually running all the time and MUST be running whenever you want to access your data. You SHOW to look at the structure but you SELECT to look at the content. You UPDATE the content of table rows but you You ALTER the structure of a table. You choose rows from a result set with a WHERE clause but you choose rows after you've grouped them with a HAVING clause. You add tables to each other "side by side" with a JOIN and you add results sets above/below each other with a UNION. You use a USE command (or other function call) to set the current DATABASE but there is no concept of current TABLE to carry through from one query to the next on a connection. REPLACE gets rid of existing rows and puts new data in their place, but UPDATE changes existing rows in situe and leaves columns that you don't re-specify unaltered. DELETE gets rid of rows completely, and INSERT puts in completely new rows. Every row in a table has the same structure (homogeneous) but different columns will have different structures (hetrogeneous). If you JOIN tables, you tell MySQL how the tables are to be connected to each other (which row(s) in the first table match which row(s) in the second) using an ON clause. A regular JOIN return only result rows where the ON clause matches up a row from each table exactly, and a LEFT JOIN return the same results and IN ADDITION any records from the left hand table specified, NULL padded to make a complete result record. You use = to check whether something has an exact value, but you use IS NULL to check for the total absence of any defined value. Some useful resources ... See our MySQL FAQ for further useful articles and the main MySQL web site for the full MySQL reference manual. We teach private MySQL courses at our centre and we run public courses too. If you've a group of trainees who all need the same course at the same time, we can run a course at your office too. We run a user forum where you can ask questions to which you can't easily find the answer elsewhere, and we post up longer articles in our solution centre. Further information is grouped by topic such as SQL Primer, more complex SQL commands, MySQL installation and admin, how to design a database and writing applications to use a database. (written 2006-02-04 06:01:20) Associated topics are indexed under S151 - Introduction to SQL and MySQLS152 - SQL Primer as Used in MySQL S153 - Sourcing, Running and Configuring MySQL S157 - More MySQL Commands
Some other Articles
Add a friendly front end with TkTwice is a co-incidence and three times is a pattern Finding where the disc space has gone NOT Gone phishing Key facts - SQL and MySQL Danny and Donna are getting married Robust PHP user inputs Changing @INC - where Perl loads its modules Job vacancy - double agent wanted Perl Regular Expressions - finding the position and length of the match 1633 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 at 50 posts per pageThis 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). |
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||