Jump to content


Photo

collation


  • Please log in to reply
6 replies to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 26 May 2006 - 07:22 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 May 2006 - 07:57 PM

[!--quoteo(post=377383:date=May 26 2006, 03:22 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 03:22 PM) View Post[/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) View Post[/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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 26 May 2006 - 08:01 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 May 2006 - 09:52 PM

[!--quoteo(post=377391:date=May 26 2006, 04:01 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 04:01 PM) View Post[/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) View Post[/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) View Post[/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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 26 May 2006 - 09:54 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#6 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 May 2006 - 10:54 PM

[!--quoteo(post=377423:date=May 26 2006, 05:54 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ May 26 2006, 05:54 PM) View Post[/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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#7 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 26 May 2006 - 10:56 PM

ok thanks again for the help, all my questions have been answered here so if someone wants to close this I am done with this posting.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users