SQL
Reset MySQL Root Password
If you have mysql- or root user shell access to the linux host where your mysql is running, you can reset the password like this:
Column count in SQL
At rare occasions you might need to know the number of columns in a database table. This isn’t necessarily as easy as counting rows.
SQL case sensitive queries
MSSQL will not search in a case sensitive way by default. Below are two popular ways to solve it.
MS Access Connection Strings
There are two common connection string types that can be used to connect to an MS Access database.
PHP MS Access connection with COM
While doing some work where I had to make a graph module in PHP based on information from an access database, I had to know how to connect to it without a database source name (DSN). I looked up PHP COM (ADODB) which worked great.
SQL random rows
To retrieve random rows in SQL you can consider the following SQL queries. It’s worth to mention that this option suit small needs best, e.g. 50-100 records/rows. This is in regards to performance and can be tested by yourself. Personally I use it for small boxes where I only want a few rows to show.
Quick note on INNER JOIN
Consider the tables, and how they are related in a chain-like way.
Let’s say that I want to list name, worktype and country. I could use code with nested for loops which is labor heavy, totally unnecessary and might even create notable delay, or I could just use JOIN.
There are three types of join, I use 2 of them quite often.
Quick note on CROSS JOIN
This is one of those things that’s nice to know when starting out as a web developer. Instead of writing 2 queries to first get 1 value from 1 table, just to be able to use it in another query against the same table again, you can instead use a subquery as a table in your main query.
Welcome to Thronic.com
Search this Site
Miscellaneous Links
Recent Articles
- Google-like search suggestion tool
- Linux Bash Color
- Resize a div layer with javascript
- Moving a div layer with javascript
- Web Galaxy » A sci-fi browser game
- Windows 7 on Asus Eee 900 PC
- IE and PHP sessions
- Wordpress 2.8.6 Spell Check Languages
- Reset MySQL Root Password
- Linux hosts file
- IdleGuard
- Column count in SQL
- String encryption in PHP
- Alphanumeric Captcha values in PHP
- Your own numeric Captcha in PHP
