| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Comments:
<0> is it just me, or is using the primary key as a way to sort stuff stupid <1> It's just you. <2> Jax: I think that depends on how the primary key is used right? <2> Especially if the primary key is a multi-column index <1> Especially if the primary key is a clustered index and you are grabbing sequential data <0> nah it's a one column index. primary key, auto_increment <1> YOU'RE THE ONE THAT'S STUPID <1> hehe <0> but just thinking when you delete something, and add something else.. you can't really change sequence.. <1> That's the problem with surrogate keys <2> as long as the data has never been manually changed, and you never need them in reverse order...it probably doesn't matter <0> hey.. i didn't design this database.. i've just been optimising this shiznit for the past couple years >;/ <3> Jax you can use that primary key to see the order things were added <3> or see the last X things very quickly <4> can anyone help me change a table id column to auto_incrment and start at 1 instead of 0? <4> i know its with alter table, i just cant the correct syntax
<5> alter table mytabl euato_increment=X <5> create table ( .... ) auto_increment=X <4> gleam, that didnt seem to work. i deleted all the values in the table, and added a new one in and it still started the id at 0 <4> i did alter table plogger_comments auto_increment=1; <4> shouldnt i have to say what column i want to change? <5> what do you mean by started at 0? <5> it should start at 1 anyway <4> the id column starts at 0 instead of one <5> that's very odd. <5> how was the table created? <5> how are you inserting data into the table? <4> see the thing is i exported a mysql 5 database to comply to mysql 3 and then imported it. all tables seem to work except this one. im inserting the data via the plogger image gallery <4> it stores comments for the images in this table <5> yikes <4> yeah i know <5> when you use --compatible it doesn't keep the auto_increment attribute. <4> everything else is working though, lol <5> your id column isn't auto increment <4> yeah thats what i wanted to alter <5> yeah you'll need to modify the column then <5> !m jessejoe alter <6> jessejoe: (ALTER PROCEDURE and ALTER FUNCTION) : http://dev.mysql.com/doc/mysql/en/ALTER_PROCEDURE.html <5> look at "MODIFY" <5> err <5> !m jessejoe alter table <6> jessejoe: (ALTER TABLE Syntax) : http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html <4> i tried reading that and got totally lost. i guess ill try again <5> modify mycol int unsigned auto_increment primary key <5> that should work <4> i did "alter table plogger_comments modify id int unsigned auto_increment primary key;" <4> i got ERROR 1068: Multiple primary key defined <4> i took out the primary key value and it seems to have worked <5> aight <4> woooo! that worked gleam, thanks so much! <5> i hate that about the --compatible option. <4> yeah, if mysql 3 can use auto_increment, why remove it? <5> because of the sql mode it sets <5> it'd be nice to have a sql mode to emulate 3.23 or 4.0 or 4.1 <4> i see. I g/g though, thanks again gleam <7> can anyone see an error with this ? <7> i can paste 2 lines right? <5> if htey're short <7> they dont wrap on my screen.. <7> $clientuname = stripslashes($_POST['login']); <5> go ahead <7> $q = 'SELECT p***word FROM users WHERE username = "'.$clientuname.'" AND active = 1'; <5> that's php <5> not mysql <7> oh :| <5> show us the actual query without variables (echo $q) and then the error it generates <8> nanotech: you should use mysql_real_escape_string in all the sql <8> and speciallty post and get vars <5> that too <5> or at the very least addslashes <5> but why do that when you can do m_r_e_s <9> is it possible to have mysql verify data , for instance that a strinng being inserted has to be 32 chars long? <5> verify in your app <7> ya, its most likely a php question, cause the i get: Error: Unknown column 'username' in 'where clause' <7> when i know the input im putting in is in the database <5> does users have a column named "username" <5> ?
<7> yes <5> oh, also use ' instead of " around strings just incase you've got the ansi_quotes sql mode <5> and because it's the right way to do it <7> thanx, realing the manual right now :) <10> for a user to be able to change his/her p***word, do they need special permissions for the mysql schema? <11> i got 2 tables... one 'rls' and one 'nukes'. is it possible to make a query that would do a "join" of these tables ONLY if rls.nuke = TRUE (boolean) ? <12> err? <13> just put this in the WHERE condition? <12> what do you mean "make the join only if"? <11> rls.nuke is either 0 or 1. if rls.nuke = 1 i want to select * from rls, nukes.... <11> but only IF one of the rows i get as an result has rls.nuke = 1 <11> like if it was possible it would be something like this: select * from rls, IF rls.nuke = 1, then select * from rls, nukes <13> This does not really make sense... rls.nuke is one field which can have another value for every row... <13> But this "join or not join" decision is one which has to be made for all rows. <13> And I doubt you want to do a cross join. <14> why are they in seperate tables <14> why not put a nuke field in the main release table? <11> bigfoot- rls.nuke is one field which can have another value for every row... thats true <15> I'm looking to copy a row column for column with the exception of the auto_increment column 'id' ... is there a way to do that in a single query without having to get the first row and then populate an insert statement with php or something? <11> EyeCue, cause i was thinking it would take less resources if i had less columns in the releases table <13> whafro: look at INSERT ... SELECT syntax. <14> but youve got a whole new table? <14> and the overhead of a join? <11> and nuke = 1 is not gonna be true for many of the records <14> the only time you want to create a new table, is if standard normalisation rules say you should <16> hi <14> ie duplication and redundancy <13> cappiz: well. is there some id in the rls and nuke table which connects those two? <14> so what if its not true <14> if its only gonna be either 0 or 1 <11> bigfoot- yeah <16> if table A has an id column and a b_id column, and b_id is a foreign key to table B <14> use it as a field in the original table <16> then how do I optimize the query: select B.id from B where B.id not in (select A.b_id from A) ????? <13> cappiz: then just do a LEFT JOIN with rls.nukeid = nuke.id AND rls.nuke = 1 <11> rls.id = PK <11> nuke.id FK <11> but i dont want to have a query that from the start takes it for granted that the rls.nuke = 1 <11> i only want to look up the nukes table if rls.nuke = 1 <11> :P <13> yes. left join... <11> hehe... like you would guess... im totally new to this <13> CellSeeker: SELECT B.id FROM B LEFT JOIN A ON A.b_id = B.id WHERE A.b_id IS NULL; <11> *read what left join means* <16> bigfott, hummmm <16> bigfoot, why would that be faster? <17> IT'S A JOIN THAT GOES LEFT OMG <16> aren't JOINs expensive? <18> it's the answer to the often asked question.."How's it joining?" .. <18> $56/join <17> If you aren't using joins you probably shouldn't be using an RDBMS at all <13> CellSeeker: because it can be done without storing much temporary data... in doubt just benchmark it (with some larger amounts of rows in both tables) <11> this is the DB i made: http://pastebin.com/738222 might be the ****tiest thing you have ever seen :P <11> bigfoot- if you could please take a look :> <11> i guess there has to be some trigger made aswel :P <19> how would I delete every row from table1 WHERE table1.RowID = table2.RowID AND table2.Delete = 'Yes'; ? <5> delete table1 from table1 join table2 on table1.rowid=table2.rowid and table2.delete='yes' <20> hello <21> If a table has a column called state_id (for say) and has 10.000 companies, is it possible to select one company from each state? I.E. Select all from companies where state_id has not been found as of yet? <20> i try to create an user in mysql: mysql> create user cybershop; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user cybershop' at line 1 <20> can you tell why do i get this error? <21> eIf: try grant <20> i see <22> hello <21> eif grant all priveleges on database.* to user identified by p***word <21> or maybe it's "p***word" <22> i have dialupadmin php interface with mysql-server , when i try to add new user i got sql error <11> 'p***word' <21> and I think I spelt priveleges wrong, too. <22> Could not connect to SQL database <20> bluelotus it's workin, thanks a lot <21> np. Goodluck eIf <11> eIf: grant all PRIVILEGES on db.* to 'user'@'host' IDENTIFIED by 'somep***word';
Return to
#mysql or Go to some related
logs:
wizzomafizzo xhost+ FC apt-get stdlibc error while getting interface flags + vmware ubuntu change firefox taskbar icon #kde waveforce gentoo dovecot printscreen yapgvb pydot #perl
|
|