Tag Info

New answers tagged

1

I would use The Party Model, so that you can associate a book with an Individual or Organization, not just an Individual. For example, you might want Random House in the role of Publisher. Or Mötley Crüe as the author of the book, not just Tommy Lee. Otherwise, looks good. You might want to consider associating the book and the PartyRole, instead of Party ...


2

UPDATE Table_1 SET EmailId = (SELECT d.EmailId FROM Table_2 d WHERE Table_1.Id = d.Id ) WHERE EXISTS (SELECT d.EmailId FROM Table_2 d WHERE Table_1.Id = d.Id AND Table_1.EmailId <> d.EmailId AND d.EmailId IS NOT NULL ...


1

I particularly like this one which works from within your (firefox) browser. If you're not a firefox user, then here is a list of alternatives.


1

Based on CL's suggestion to take another look at last_insert_rowid() and now that it's clear that INSTEAD OF triggers are only for VIEWs (see question's comments), here's a working version: -- We need a view to create the trigger on CREATE VIEW Container_Auto AS select * from Container; -- Since it's automatic we need to check if we need to create a root ...


2

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.15 MySQL Community Server (GPL) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ...


0

You query will need DISTINCT, so it doesn't return the values multiple times: SELECT DISTINCT a FROM table WHERE a NOT IN (SELECT a FROM table WHERE b = 3) ; Also beware that NOT IN may return unexpected results if your columsn are nullable. It's safer to use NOT EXISTS or LEFT JOIN / IS NULL: SELECT DISTINCT a FROM table AS x WHERE NOT EXISTS (SELECT ...


0

Amend your table definition as following to add two additional indices (My apologies for the SQL Server syntax - it's all I have here at the moment): CREATE TABLE IF NOT EXISTS tutte_polynomial( graph_id INTEGER, x_degree UNSIGNED INTEGER, y_degree UNSIGNED INTEGER, coeff INTEGER ,primary key clustered ...



Top 50 recent answers are included