Jump to content

collation


Ninjakreborn

Recommended Posts

What do I need to learn about collation in a database, there are so many different ones does it matter which one I use, or are each one for a purpose, I have been looking online for a reference, and couldnt finding anything that went into very much detail about collation.

I was also wondering one other thing, is there a way to avoid using the dbms like for instance phpmyadmin
and getting directly to a file where you can use all sql commands, and it keeps track of them, I have heard of using sql comments, but when I create a database using phpmy admin, and I just put in all the syntax even if I put in a comment, I never get to look at it again, that is what is confusing me, I need to understand this part of databasing before I Get much further.
Link to comment
Share on other sites

[!--quoteo(post=377383:date=May 26 2006, 03:22 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 03:22 PM) [snapback]377383[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What do I need to learn about collation in a database, there are so many different ones does it matter which one I use, or are each one for a purpose, I have been looking online for a reference, and couldnt finding anything that went into very much detail about collation.
[/quote]
Basically, you have to decide if you're going to be storing non-ASCII characters or not. If non-ASCII is important, I suggest you use UTF-8, and that way, you'll never have to worry about anything ever again. Granted, there are some subtleties involved, but the refman covers them all.

[!--quoteo(post=377383:date=May 26 2006, 03:22 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 03:22 PM) [snapback]377383[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I was also wondering one other thing, is there a way to avoid using the dbms like for instance phpmyadmin
and getting directly to a file where you can use all sql commands, and it keeps track of them, I have heard of using sql comments, but when I create a database using phpmy admin, and I just put in all the syntax even if I put in a comment, I never get to look at it again, that is what is confusing me, I need to understand this part of databasing before I Get much further.
[/quote]
I'm not sure I understand what you mean -- if you have shell access to the server, you can connect via the command-line. Otherwise, you need some sort of front-end to issue the commands, be in PHPMyAdmin, a MySQL client, PHP/Perl script, etc.
Link to comment
Share on other sites

So for all the adding and removing data, I just use php scripts in my pages, like when someone fills out a form, it either adds it or removes it from the database.
What about comments, why would someone ever comment there sql code, because it is never able to be read, or is that comnent mark meant to comment the sql commands if you need to during your php scripts. I am still new at the databasing part, I have done basic creation of databases but some of this other stuff I am working with right now, like for instance what is the collation
latin1_swedish, then some stuff after it, what collation is that, is it safe to use most/all the time it is what phpmyadmin set them too, I created them using sql syntax, and it automatically set them to that collation.
Link to comment
Share on other sites

[!--quoteo(post=377391:date=May 26 2006, 04:01 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 04:01 PM) [snapback]377391[/snapback][/div][div class=\'quotemain\'][!--quotec--]
So for all the adding and removing data, I just use php scripts in my pages, like when someone fills out a form, it either adds it or removes it from the database.
[/quote]
That's correct.

[!--quoteo(post=377391:date=May 26 2006, 04:01 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 04:01 PM) [snapback]377391[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What about comments, why would someone ever comment there sql code, because it is never able to be read, or is that comnent mark meant to comment the sql commands if you need to during your php scripts. I am still new at the databasing part, I have done basic creation of databases but some of this other stuff I am working with right now, like for instance what is the collation
[/quote]
You can't really "comment" MySQL statements per se, because the language is just a set of instructions, so the comments are simply ignored. I don't know what comment mark you're referring to.

[!--quoteo(post=377391:date=May 26 2006, 04:01 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 04:01 PM) [snapback]377391[/snapback][/div][div class=\'quotemain\'][!--quotec--]
latin1_swedish, then some stuff after it, what collation is that, is it safe to use most/all the time it is what phpmyadmin set them too, I created them using sql syntax, and it automatically set them to that collation.
[/quote]
Latin is the default charset for MySQL, now called latin1_swedish_ci (case-insenstive) in 4.1+, AFAIK. As indicated above, this does not provide support for all languages, but will cover most Latin-based languages and characters. It's much easier to use this if at all possible, but if you app requires multi-language support, then UTF-8 is the way to go.
Link to comment
Share on other sites

perfect, the mysql, or sql commenting I was referring to is something I read in a book called php in a nutshell here is an excerpt from the book.
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Before you start diving into the world of SQL, just a short note about commenting your SQL code. In SQL, there are a number of ways to comment your code, of which the most popular are /* */ and #, both of which are seen in PHP. Of the two, # is more popular - like PHP, it comments to the end of the line.

Author's Note: I personally find # good for SQL because I never use it in PHP scripts - it makes the distinct between complex SQL queries and PHP code that little bit more obvious. Choose what fits you best.
[/quote]
That is the area I saw that information on, and I was trying to figure out why he was speaking of commenting the sql, I didn't see the point that is why I was asking.
Link to comment
Share on other sites

[!--quoteo(post=377423:date=May 26 2006, 05:54 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 05:54 PM) [snapback]377423[/snapback][/div][div class=\'quotemain\'][!--quotec--]
perfect, the mysql, or sql commenting I was referring to is something I read in a book called php in a nutshell here is an excerpt from the book.

That is the area I saw that information on, and I was trying to figure out why he was speaking of commenting the sql, I didn't see the point that is why I was asking.
[/quote]
Yeah, that's why books suck. If you're going to have a place to put SQL-style comments, you might as well simply but them "one line above" in the PHP script itself -- no need to put them any other place.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.