Four Basic Commands
I think I’ve been brainwashed by movies to think that imparting knowledge to the next generation can take place during a 5 minute montage where they go from knowing nothing about coding to being proficient enough to make a difference. At least, that’s the movie that was playing in my head leading up to my first attempt to sit down with them. I bet musicians and other professionals see things the same way when they think about getting their children doing something with them. No one envisions the years of work, the motivation, and the general pain that it takes to put in the time to get to the point where they are in their career. I mean, we were all naturals, right?
So last week I constructed a couple of table to keep track of some inventory data. I purchase some things online to sell, and I want to be able to keep track of it all, figure out what’s profitable and know when to buy. Lead time is almost as complicated as making sure you have funds to buy things– and they are kind of dependent on each other.
Having come up with the first couple of tables– one to keep track of the purchase and a look up table to keep where I bought it from– I thought I was ready to introduce the kids to a table to keep track of what I had in stock. Only, I don’t know that I have it 100%– it’s one of those things where I have two different ideas of how to get it done, and I’m not sure which one I like, but we’re dealing with such small data that I can try a way and then mold it differently to meet my needs.
In the process of creating the next table, I introduced the kids to the idea of the four basic sql commands: SELECT, INSERT, UPDATE, DELETE.
SELECT -- This is what you use to find out what's in a database table INSERT -- This is what you use to put stuff into a database table UPDATE -- This is what you use to change stuff in a database table DELETE -- This is what you use to get rid of stuff from a database table
What’s a database table? Imagine a spreadsheet with rows and columns– or maybe a table in your word processor where you have headings and then items beneath it. In any case, it is the data that you want to keep track of. The database allows you to do it using these functions.
There are other functions for creating tables, and defining procedures and functions, which we’ll get into later, but the important thing is to remember these building blocks. In subsequent posts I’ll get more into the syntax of each of these with things for you to try– of course if you’re not living in my house there’ll be more setup, and I can certainly give more posts on how to get setup, but since this is documenting what I’m doing, I’m already set up!