Computing desk | ||
---|---|---|
< October 2 | << Sep | October | Nov >> | October 4 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I have a database with some humans who each own zero or more dogs. Every dog has a human owner, so the schema is something like:
CREATE TABLE dogs (rowid PRIMARY KEY INTEGER, name TEXT, birthdate DATE, owner FOREIGN KEY (human));
(I might not have the above syntax exactly right), and similarly there's a humans table with names and addresses or whatever, plus rowids. The dog owner column will contain the rowid of a a row in the humans table.
I'd like to add a new human named Bob, and Bob's dog Fido to the database. That means I have to insert two rows (in a transaction but that shouldn't be relevant). I do an INSERT statement for Bob and another one for Fido. But to insert Fido's row, I need Bob's rowid.
The INSERT statement doesn't give back the rowid it has created. Do I actually have to do a total of three statements, two inserts separated by a SELECT to get back Bob's rowid? How do I know that the rowid I got is the row that I just inserted (maybe there is already another Bob in the database), etc.? Thanks.
If it matters, I mostly use sqlite3 right now, but will probably want to start using postgres and maybe mysql at some point. I'm unlikely to ever care about MS or Oracle.
173.228.123.207 ( talk) 00:47, 3 October 2019 (UTC)
INSERT NAME = " " BDATE = " " ... OWNER_ROW_ID = (SELECT ROW_ID FROM OWNER WHERE ... ); INTO DOG;
I use several text editors, including Notepad++ and MS Word, and I'm constantly selecting text to change the font, etc. I can double-click on a word/phrase to select it, but the selection won't extend beyond the typical delimiters (i.e. period (.), dash (-), etc.). I'm a programmer, so a lot of the words I'm highlighting are things like "test-object-1", where ideally I'd like double-clicking to select the entire object instead of just one of the three "words". Is there a way to do that, possibly an add-on that I could install? I typically work on both Windows and Linux machines. OldTimeNESter ( talk) 15:05, 3 October 2019 (UTC)
Is there a way to make it so no web sites can even ask if I want notifications ? I don't ever want them, and find being asked the question, repeatedly, annoying. SinisterLefty ( talk) 18:32, 3 October 2019 (UTC)
Computing desk | ||
---|---|---|
< October 2 | << Sep | October | Nov >> | October 4 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I have a database with some humans who each own zero or more dogs. Every dog has a human owner, so the schema is something like:
CREATE TABLE dogs (rowid PRIMARY KEY INTEGER, name TEXT, birthdate DATE, owner FOREIGN KEY (human));
(I might not have the above syntax exactly right), and similarly there's a humans table with names and addresses or whatever, plus rowids. The dog owner column will contain the rowid of a a row in the humans table.
I'd like to add a new human named Bob, and Bob's dog Fido to the database. That means I have to insert two rows (in a transaction but that shouldn't be relevant). I do an INSERT statement for Bob and another one for Fido. But to insert Fido's row, I need Bob's rowid.
The INSERT statement doesn't give back the rowid it has created. Do I actually have to do a total of three statements, two inserts separated by a SELECT to get back Bob's rowid? How do I know that the rowid I got is the row that I just inserted (maybe there is already another Bob in the database), etc.? Thanks.
If it matters, I mostly use sqlite3 right now, but will probably want to start using postgres and maybe mysql at some point. I'm unlikely to ever care about MS or Oracle.
173.228.123.207 ( talk) 00:47, 3 October 2019 (UTC)
INSERT NAME = " " BDATE = " " ... OWNER_ROW_ID = (SELECT ROW_ID FROM OWNER WHERE ... ); INTO DOG;
I use several text editors, including Notepad++ and MS Word, and I'm constantly selecting text to change the font, etc. I can double-click on a word/phrase to select it, but the selection won't extend beyond the typical delimiters (i.e. period (.), dash (-), etc.). I'm a programmer, so a lot of the words I'm highlighting are things like "test-object-1", where ideally I'd like double-clicking to select the entire object instead of just one of the three "words". Is there a way to do that, possibly an add-on that I could install? I typically work on both Windows and Linux machines. OldTimeNESter ( talk) 15:05, 3 October 2019 (UTC)
Is there a way to make it so no web sites can even ask if I want notifications ? I don't ever want them, and find being asked the question, repeatedly, annoying. SinisterLefty ( talk) 18:32, 3 October 2019 (UTC)