Skip to content
Advertisement

Tag: database

Doing a WHERE .. IN subquery in Doctrine 2

I’d like to select order items from all orders with a specific item. In SQL I’d do it like this: How would I do this query with the query builder? Answer This is how I would try it: I didn’t test this of course, and made some assumptions about your models. Possible problems: Limit: this has been somewhat of a

Select NULL Values in SQLAlchemy

Here’s my (PostgreSQL) table — I want to select all people that are not known to be married, i.e., including those with NULL marriage_status. This does not work — Of course this does — The problem is that I’m accessing it from SQLAlchemy with — which gets translated to — And does not work — neither does — How should

How to do a batch insert in MySQL

I have 1-many number of records that need to be entered into a table. What is the best way to do this in a query? Should I just make a loop and insert one record per iteration? Or is there a better way? Answer From the MySQL manual INSERT statements that use VALUES syntax can insert multiple rows. To do

NOT DEFERRABLE versus DEFERRABLE INITIALLY IMMEDIATE

I read this about the SQL keyword DEFERRABLE in Database Systems – The Complete Book. The latter [NOT DEFERRABLE] is default, and means that every time a database modification statement is executed, the constraint is checked immediately afterwards, if the modification could violate the foreign-key constraint. However, if we declare a constraint to be DEFERRABLE, then we have the option

Freeware Query Builder [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 7 years ago. Improve this question I’m looking for some freeware Query Builder. Query Builder in Aqua Data Studio allows you to visually build queries: select the column you want

MySQL query finding values in a comma separated string

I have a field COLORS (varchar(50)) in a my table SHIRTS that contains a comma delimited string such as 1,2,5,12,15,. Each number representing the available colors. When running the query select * from shirts where colors like ‘%1%’ to get all the red shirts (color=1), I also get the shirts whose color is grey (=12) and orange (=15). How should

Advertisement