Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualaburningflame

Posted 28 December 2012 - 12:19 AM

im not quite sure, it just feels more efficient if u could virtually link a user with his own item table, instead of checking one by one every item the user has gotten on a database lots of users are going to use, lets say i have 1000 users and 1000 items, whenever i wanna see items for user 123, i would have to loop through the entire character_item table, to check for his CID, i am fairly new to the database subject but that just feels unefficient, i guess im just thinking like object oriented.

SELECT * FROM character_item WHERE character_id=123

 

This is very efficient. Database engines are blazing fast.

 

 

 

SELECT * FROM character

[code to programatically loop and check for user 123]

^INEFFICIENT

 

 

SELECT * FROM character WHERE user=123 (this will only return x items. where x is the # of items user 123 has)

[code to programatically loop and assign the returned resultset to user 123's inventory]

^EFFICIENT

 

http://www.w3schools.com/sql/sql_where.asp   Keep hitting next chapter.

 

Good luck!


#3aburningflame

Posted 28 December 2012 - 12:17 AM

im not quite sure, it just feels more efficient if u could virtually link a user with his own item table, instead of checking one by one every item the user has gotten on a database lots of users are going to use, lets say i have 1000 users and 1000 items, whenever i wanna see items for user 123, i would have to loop through the entire character_item table, to check for his CID, i am fairly new to the database subject but that just feels unefficient, i guess im just thinking like object oriented.

SELECT * FROM character_item WHERE character_id=123

 

This is very efficient. Database engines are blazing fast.

 

 

 

SELECT * FROM character

[code to programatically loop and check for user 123]

^INEFFICIENT

 

 

SELECT * FROM character WHERE user=123 (this will only return x items. where x is the # of items user 123 has)

[code to programatically loop and assign the returned resultset to user 123's inventory]

^EFFICIENT


#2aburningflame

Posted 28 December 2012 - 12:17 AM

im not quite sure, it just feels more efficient if u could virtually link a user with his own item table, instead of checking one by one every item the user has gotten on a database lots of users are going to use, lets say i have 1000 users and 1000 items, whenever i wanna see items for user 123, i would have to loop through the entire character_item table, to check for his CID, i am fairly new to the database subject but that just feels unefficient, i guess im just thinking like object oriented.

SELECT * FROM character_item WHERE character_id=123

 

This is very efficient. Database engines are blazing fast.

 

 

 

SELECT * FROM character //programatically loop and check for user 123 <<INEFFICIENT

 

 

SELECT * FROM character WHERE user=123 (this will only return x items. where x is the # of items user 123 has)

//programatically loop and assign the returned resultset to user 123's inventory


#1aburningflame

Posted 28 December 2012 - 12:15 AM

im not quite sure, it just feels more efficient if u could virtually link a user with his own item table, instead of checking one by one every item the user has gotten on a database lots of users are going to use, lets say i have 1000 users and 1000 items, whenever i wanna see items for user 123, i would have to loop through the entire character_item table, to check for his CID, i am fairly new to the database subject but that just feels unefficient, i guess im just thinking like object oriented.

SELECT * FROM character_item WHERE character_id=123


PARTNERS