SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 21/03/2014, 01:05 PM   #1
iRaiDeN
Huge Clucker
 
iRaiDeN's Avatar
 
Join Date: Mar 2014
Location: Israel
Posts: 480
Reputation: 41
Default MySQL-queries

Hey,
A week ago I learned opinion, MySQL, I am skilled in.
And now this manual mainly focus on basic ה"שאילתות".

# SELECT.
# WHERE.
# INSERT.
# OR.
# AND.

SELECT STATEMENT

The query that you actually pick the table you choose open entries.
PHP Code:
SELECT ' value ' FROM ' key ' 
In fact chose the value value in the key table, give an example,
PHP Code:
SELECT ' name ' FROM ' accounts ' 
In fact we have chosen the name value of the accounts table.
To give another example,
PHP Code:
SELECT FROM ' accounts ' 
In fact it takes all values, if you want to get some good values.
PHP Code:
SELECT ' name '' password '' kills ' FROM ' accounts ' 
In fact it takes the name values, paassword, kills, from accounts.
Now another example,
PHP Code:
SELECT ' ID ' FROM ' accounts ' WHERE ' username ' ' iRaiDeN 
It selects the value ID, from accounts, where the name is iRaiDeN.
The query WHERE CLAUSE study.

WHERE CLAUSE

Now this query actually turns to where you like where is X.
To give an example,
PHP Code:
SELECT ' password ' FROM ' accounts ' WHERE ' username ' ' iRaiDeN 
As above, select the password entry, where is and where the accounts table is the username iRaiDeN.

INSERT
Action actually gets values to the table we want
PHP Code:
INSERT INTO ' accounts ' (' username '' password '' kills '' death 'VALUES (' iRaiDeN '' 123 '00
In fact we have added entries for the accounts table values username, password, kills, death, and each has its own value.

OR

This function basically saying "or" I will give an example to illustrate.
PHP Code:
SELECT ' password ' FROM ' accounts ' WHERE ' username ' ' iRaiDeN ' OR ' username ' ' OzSasson 
Basically this selects the entry password, from accounts, where iRaiDeN is the name or if the name is OzSasson.

AND

A query that says "also", in addition, give an example and explained,
PHP Code:
SELECT ' password ' FROM ' accounts ' WHERE ' username ' ' iRaiDeN ' AND ' ID ' ' 2 ' 
We chose the entry password from accounts where the username value, which is equal to iRaiDeN, and also the value ID equals 0.

The end of the Guide, I just have a few comments,
* Do.
'' Values.
*
In '' the name of the database/table/field.
* Committed to write the queries only in writing.
All those OS.
iRaiDeN is offline   Reply With Quote
Old 21/03/2014, 02:17 PM   #2
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,067
Reputation: 2660
Default Re: MySQL-queries

I hardly understood anything at all. Please try to to improve your English. Wrapping field names in quotes is invalid and will throw an error. Wrapping any non-string value in quotes is also unnecessary.
__________________
Vince is offline   Reply With Quote
Old 21/03/2014, 03:20 PM   #3
iRaiDeN
Huge Clucker
 
iRaiDeN's Avatar
 
Join Date: Mar 2014
Location: Israel
Posts: 480
Reputation: 41
Default Re: MySQL-queries

Quote:
Originally Posted by Vince View Post
I hardly understood anything at all. Please try to to improve your English. Wrapping field names in quotes is invalid and will throw an error. Wrapping any non-string value in quotes is also unnecessary.
i know it's translated form hebrew, i'm i sory, i don't have any power to improve all to english.
iRaiDeN is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL nested queries SoulRipper113 Scripting Help 2 05/11/2013 06:13 PM
MySQL queries question ReLoaD90 Scripting Help 2 27/06/2013 02:21 PM
Many mySQL queries MP2 Scripting Help 9 09/04/2013 12:49 AM
Help with MySQL queries LiamM Scripting Help 4 20/03/2013 10:37 AM
Counting with mysql queries actiwe Help Archive 2 26/02/2010 02:36 PM


All times are GMT. The time now is 07:45 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.