Hi hi hi… IT knowledge lovers… you are on my blog at “We Are
Knowledge”.. In here you will getting many IT knowledge from desktop
programming until web programming.. you will get and take FREE.. So you must
read this article..
Likely this article to fill IT knowledge, because now, I
want giving you IT knowledge about “MYSQL” and I will discuss this time is :
1. Displays a random record
So let’s do read!!
1. Displays a random record
MYSQL programming language facilities are also available to
display random records. Usually the query is used to retrieve one or more names
for gifts or anything else.
Select different if select on a first in first out . Usually
to display the records in a table we use the "select" button, just
halna by displaying records randomly. we need the command "select".
But a little differently on the addition of query "order by", we have
to add the query "RAND" or "RANDOM". because in mysql simply
enter the 4 (four) main character. so just input "RAND".
Example 1 :
SELECT id_hardware, name_hardware, price_hardware,
quantity_hardware
FROM hardware
ORDER BY RAND();
To Result :
| id_hardware |
name_hardware| price_hardware|quantity_hardware |
|3 |
VGA | 3500 |
4 |
|1 |
HARD DISK | 4000 | 3 |
|2 |
MEMORY | 2500 | 1 |
|5 |
DVD ROOM | 2200 | 2 |
Example 2 :
SELECT id, name, position, commission, salary
FROM employee
ORDER BY RANDOM();
To Result :
| id | name | position
| commission | salary |
|3 | Rocky | programmer | $ 500 | $ 2500 |
|1 | Smith | accountant
| $ 350 | $ 2200 |
|2 | Jhon | programmer
| $ 500 | $ 2500 |
|5 | Silva | manager
| $ 800 | $ 4000 |
Ok just it…
I hope you like..
See you later friends..
No comments:
Post a Comment