MyBB Community Forums

Full Version: Need someone to explain how to create SQL query?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Guys please could you explain how to create SQL query to fetch data from database? This is the part I am really struggling with?

What is simple-select query????
You select something.

Example:

Select from users where id = 1;


Outputs Choose from users where the id = 1.
(2014-05-26, 05:47 PM)Ace700 Wrote: [ -> ]You select something.

Example:

Select from users where id = 1;


Outputs Choose from users where the id = 1.

Thanks but could you please post an example query and then break it into sections?
Sure:

Lets pertend we have a table named users, 1 column named name, and there are 4 rows.

Ace700
Mybb
Bob
Marcus

Okay so we do select * from users where name = 'Ace700';

What happens is if there is a person named Ace700 it will output it.

Select * - means grab all
From users - is where its being grabbed from.
where name = is where the name is coming from in the users table.

* = wildcat so it can be anything. Hope this helps a little bit. Otherwise if not try this example:

http://www.w3schools.com/sql/trysql.asp?...select_all
Dude +1 thanks very much specially for the link to the simulator.