MemphiS Posted June 29, 2007 Share Posted June 29, 2007 Just wondering about a few things mysql_query("SELECT test FROM table WHERE id = '1' LIMIT 1"); Should i place LIMIT 1 to clarify the query? mysql_query("DELETE FROM table WHERE table.id = '1' LIMIT 1"); or should i simply go: mysql_query("DELETE FROM table WHERE id = '1' LIMIT 1"); Thanks for your responces Anything else that is "good" practice could you post aswell.. Link to comment https://forums.phpfreaks.com/topic/57713-correctly-using-sql/ Share on other sites More sharing options...
Illusion Posted June 29, 2007 Share Posted June 29, 2007 DELETE FROM table WHERE id = '1' LIMIT 1 will work no need to specify like WHERE table.id = '1' unless you use multiple tables with same name of columns. Link to comment https://forums.phpfreaks.com/topic/57713-correctly-using-sql/#findComment-285740 Share on other sites More sharing options...
fenway Posted June 29, 2007 Share Posted June 29, 2007 Well, assuming that's the UID, the limit isn't necessary either.... but personally, I always use table aliases all the time, so that if I need to add another table, I don't have to change anything. Link to comment https://forums.phpfreaks.com/topic/57713-correctly-using-sql/#findComment-285758 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.