Let's say I want to write a simple SELECT query that uses a VIEW: CREATE TEMP VIEW people AS SELECT p.person_id ,p.full_name ,p.phone FROM person
What I'm trying to do is use more than one CASE WHEN condition for the same column. Here is my code for the query: SELECT Url='', p.ArtNo,
I'm getting an error at this statement: cursor.execute("SELECT * FROM dbo.User") Error: pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driv
I would like to have a SQL formula to match all the words in a query in any order without using multiple 'AND like' statements. For example, the query 'cat dog
I'm migrating a site from Site5 hosting to InMotion Hosting and the importation of the mysql file (via phpMyAdmin) is not working. import of mysql file failed,
I had a fairly straightforward interview question: return all countries that have more customers than the average number of customers of all cities. country ta
I have 2 tables and I need to delete rows from both tables if A.itemID does not exist in table B I've tried doing : DELETE a,b FROM A a, B b WHERE NOT E
Context: I have a select query where I have have link between devices. Some links have "reverse duplicates" that I would like to get rid of in the select query
I want to group by one column, get both min and max of a second column, and (this is the tricky part!) get the value from a third column where the second column
When I try to test any app with command (I noticed it when I tried to deploy myproject using fabric, which uses this command): python manage.py test appname
I'm getting a data that return like this: | id | name | | 1 | customer1 | | 2 | customer2 | | 3 | customer3 | | 4 | customer4 | Now I want to rotate
I've created the folllowing Union query, which works fine most of the time: SELECT [%$##@_Alias].[Contact ID], [%$##@_Alias].[Mailing Name] FROM (SELECT [Refer
I have a table containing graduate ids, degree titles and graduation years. The table can contain any number of rows for each graduate. I would like to create
How can we convert a string of any length into a comma separated string with comma after every n characters. I am using Oracle 10g and above. I tried with REGEX
When I want to define a custom sort order in a MySQL query I can do something like this: ORDER BY FIELD(language,'USD','EUR','JPN') What would be the Eloquen
Here is my schema using sqlite, I am not sure if this is a good way to create tree structure in sql as I have to traverse many time to obtain the entire tree, a
Im confused why it could not be Select x.continent, x.name From world x Where x.name <= ALL (select y.name from world y where x.name=y.name) ORDER BY name
I'm trying to switch from SQL Server to MySQL, hence some queries need to be converted. The following SQL Server query gives my desired output: SELECT top 20 c.
A very easy one for someone, The following insert is giving me the ORA-01722: invalid number why? INSERT INTO CUSTOMER VALUES (1,'MALADY','Claire','27 S
(PostgreSQL 8.4) I got a great introduction to SQL gaps-and-islands here on Stack Overflow but I still have a question. Many island detection CTEs are based on