Question:
How to learn how to use msql/databases?
Steve
2008-10-23 23:46:27 UTC
I know some php but I want to write my own website where users may log in and see their own unique page. I know this will include the use of msql databases but I have no idea on how to do anything with them.

Thanks for all the help
Five answers:
halfFAST
2008-10-24 01:06:41 UTC
I would suggest getting familiar with SQL first. Don't try mixing processing query results in PHP and learning how to do SQL into one job. It will complicate things unnecessarily. You can do a lot with just a local MySQL database and a decent administration tool. I'd recommend getting MySQL 5.0 with the GUI administrator utility. Its free and pretty easy to use and you don't have to worry about bandwidth or code or blowing anything up and losing all your data.



To really be able to play around though, you are going to need to know some basic concepts and terminology. Here is how it makes sense in my head(I am no expert on the matter though, so follow up with some authoritative sources).



These things are central to most any database system and if you understand how they work together, you can have a pretty good chance at finding your way around just about any database system(or at least not be quite as lost):



Users

Databases

Tables

Views

Queries

Functions



They very loosely fit together like this: Users(database users, not your site visitors) have different access rights that allow them to do different things with different databases. A database is a way of organizing different sets of related or connected data(databases should be used this way anyways - though most cheap web hosts will only allow you one database to play with - and only one database user for that matter).



Inside a database, you can have many tables of actual data. This is where you can store your actual data in a row/column format(much like cells in a spreadsheet). This part is where you will spend most of your time doing SQL statements to do pretty much everything regarding the actual storage, removal and editing of any of your data. Tables should help you organize your information into useful, convenient and compact groupings. It is really a balance between these factors (and of course performance and maintenance overhead) that make up the bulk of being somewhat decent at creating and maintaining a database.



A basic rule of thumb is that you want to avoid repetition in your data. This concept is often summed up with the term database normalization(or just normalization - look it up real quick, but don't try becoming an expert on your first go). It is very easy to get carried away with this, so resist the impulse to normalize anything and everything once you start learning about it. Just use what makes sense for your application and what makes things easier to work with. But definitely know what it is. The terms INDEX, FOREIGNKEY and PRIMARYKEY should be understood before any serious effort to do this is made - else, you may become lost and confused and your database will seem like it is slow and wasteful.



You can offset a lot of the maintenance issues by setting up a view(once you have a need for them and are familiar with the SQL JOIN and/or UNION statements). A view is kinda like a custom way of looking at a bunch of pieces of data - either from different tables or with additional information appended to a result set(things like maximum values, counts or other useful bits of information) - in a set, specific way. These will become very useful as you begin to incorporate the ideas of data normalization into your database(probably can ignore them until then, but again, know they exist).



Queries are the bread and butter of everything you do. They are what makes SQL a Structured Query Language. You tell your database how to do anything and everything with a query. Even the GUI interfaces(MySQL administrator, PHPMyAdmin) use queries to shape and form your database into something useful. This is where you will really want to dig in and read over documentation and follow some examples. Start with SELECT, then once you feel comfortable with that, move onto the other main types of queries(UPDATE, CREATE, ALTER, TRUNCATE, DROP - be careful though, there is no undo...) as well as the many query operations(things like LIKE, LIMIT, JOIN, UNION, ORDER BY, GROUP BY/HAVING - SQL is pretty powerful and probably has a way to get it to do what you want as far as data manipulation and storage goes. It is really just a matter of becoming familiar with what is out there, and then learning how to best implement your solutions).



Functions can be as varied as the different database engines. I recommenced MySQL, mostly because that is probably what you have running if you are running on a PHP server(MSSQL is another popular choice for web hosting companies, though not nearly as much as MySQL). Functions serve the purpose of making common tasks easier. There are things like COUNT() NOW() UCASE() LCASE() MAX() MIN() AVG() and many many more. Again, knowing they are out there will save you a lot of time in not having to recreate the wheel.



My main intent is to give a good background, and a lot of keywords to search off of. Really though, you will want to dive in and start playing around with things as that is the best way to learn.
?
2016-09-08 02:18:56 UTC
I consider in case you changed the phrase "notion" with the synonymous phrase "speculation" you do not need a difficulty. Unless you are thoroughly unthinking, it is not possible not to have already got a preconceived recommendations approximately what you are going to study. There's not anything flawed with already having ideals, you cannot no longer have them... Anyhow because the outcomes of studying you study in case you had been both proper, flawed, or slightly each on your ideals. Let's take whatever practical as an instance. The Earth actions across the Sun. My Preconceived Hypothesis: From revel in I can watch the solar transfer around the sky. The Earth feels love it's lovely nonetheless. So you can still most effective finish that the Sun is the one that's truthfully relocating. ^The above is nonetheless improper. The argument towards the above is that while you do the maths it is plenty less complicated for the Earth and planets to be circling the Sun and no longer the whole lot circling the Earth. Also we will be able to research Venus and be aware how the darkish part of Venus alterations (see as Venus is going across the solar distinctive constituents of it are lit up displaying that it is relocating across the Sun). And why it feels just like the Earth isn't relocating is defined when you consider that we're correctly "relocating with" the Earth. ===== As a part be aware I disagree with the man or woman who stated "ideals have a tendency to get in the best way". That's no longer actual, correctly, such a lot medical data are truthfully "ideals" earlier than they are tested. You have a notion, you cross out and end up that notion. Copernicus believed the Heliocentric mannequin, he went out and proved it.
Cazpa
2008-10-24 01:12:45 UTC
i am learning php atm and found there are some good tutorials online and also try looking on youtube as people hae uploaded some great little tutorials there also.



I am reading a real good book at the moment called "how to do everything with php and mysql", check it out on amazon or ebay its worth it



Good Luck
2008-10-24 01:04:21 UTC
If you already have your feet wet with PHP you can check out these tutorials ( http://www.w3schools.com/PHP/php_mysql_intro.asp ). They show you everything from connecting to a database to deleting things from the database.
Plondaranera
2008-10-23 23:49:13 UTC
There's a bunch of tutorials on the web. Google them.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...