Data dodania Pytanie
2017-02-14 23:02 Why are the following SQL queries not equivalent? »
SELECT c.cname FROM Customers c WHERE c.age > ALL (SELECT c2.age FROM Customers c2 WHERE c2.type = 'snowboard'); SELECT c.cname FROM Customers ...
(1) odpowiedzi
2017-02-14 20:02 Postgres WITH RECURSIVE CTE: sorting/ordering children by popularity while retaining tree structure (parents always above children) »
I'm building a forum, very much like Reddit/Slashdot, i.e. Unlimited reply nesting levels Popular comments (ordered by likes/votes) will rise to the...
(2) odpowiedzi
2017-02-14 13:02 Remove duplicates using only where condition »
Today, i got a problem from a friend. Problem - Write a SQL query using UNION ALL(not union) that uses the where clause to eliminate duplicates. I ...
(3) odpowiedzi
2017-02-14 11:02 Making a partition query, reporting the first NOT NULL occurrence within partition before current row (if any) »
I have a logins table which looks like this: person_id | login_at | points_won -----------+----------------+---------------------- 1 ...
(2) odpowiedzi
2017-02-14 10:02 Create nested json from sql query postgres 9.4 »
I need to get as a result from query fully structured JSON. I can see in postgres that there are some built in functions that may be useful. As an e...
(2) odpowiedzi
2017-02-13 22:02 Show Percentages for Week and Year »
I have this sql syntax, which works great. It shows the count of sources utilized to get to us. I want the number to be shown in percentages (out of 1...
(1) odpowiedzi
2017-02-13 19:02 SQL query works by itself but breaks with 'unknown column in on clause' in stored procedure »
My select query with an inner joined subquery works when I run it alone, but results in the error Unknown column 'cities.state' in 'on clause' in the ...
(3) odpowiedzi
2017-02-13 16:02 how to create a table in SQLAlchemy using Postgres? »
Hi I'm trying to create a Table using SQLAlchemy in Postgres, it process all well but the table is not created in my Postgres server. My models.py fi...
(1) odpowiedzi
2017-02-13 14:02 How to sort alphanumeric String in oracle? »
Input is: Section1 Section2 Section3 Section10 Section11 Section1A Section1B Section12 Section11A Section11B And I want output like: Section1 Sect...
(1) odpowiedzi
2017-02-13 10:02 no method error at index get request ruby »
Any experts on hand for what I am sure is a quick fix. I am running sinatra with ruby controller & models, with erb view files. I only want to que...
(1) odpowiedzi
2017-02-13 08:02 SQL: Order by rowID and then by column based on the rowid »
I have the following 'departments' table: +-------+-------------+-------------------+ | rowid | department | parent_department | +-------+----------...
(1) odpowiedzi
2017-02-13 07:02 Comma separated values with all rows from a table »
I have a Services table with three columns. Service sr_id lang alias 1 EN A 1 PA B 1 HI C 2 EN D 2 HI E Now, I...
(2) odpowiedzi
2017-02-12 23:02 Query Queried Table Laravel »
I was wondering if we could query already queried table. Like this: $results = Table::where('name','like', '%'.$request['name'].'%')->get(); $resu...
(1) odpowiedzi
2017-02-12 22:02 How to select the first part of string that has a match in list of values in PostreSQL? »
I'm working with medical data and I want to find the primary diagnosis given to certain patient. The diagnoses are all in one column as a comma separ...
(3) odpowiedzi
2017-02-12 22:02 Active Record where join table record doesn't exist »
I am trying to get a list of all records that don't exist in a join table. The models are User, Game and MarkedGame, where users can mark games as pl...
(2) odpowiedzi
2017-02-12 15:02 sql - Unpivot a join between two tables with the same column names »
I am having trouble with unpivoting the results of a join between two tables. The two tables are defined as: create table scores_jan ( id number ...
(5) odpowiedzi
2017-02-12 13:02 Sort by specific order, including NULL, postgresql »
best explained with an example: So I have users table: id name product 1 second NULL 2 first 27 3 first 27 4 last 6 5 ...
(2) odpowiedzi
2017-02-12 02:02 Getting command not properly ended while testing for empty relations »
I am reading database systems concepts book by Henry Korth.I tried the following exactly from the book for empty relations test. select course_id fro...
(1) odpowiedzi
2017-02-11 23:02 SQL - Change value on Row 3 when Case condition is met on Row 1 »
Am using SQL Oracle and trying to find out, based on below data set, how can I update row 3 when condition is met on row 1? Rule is: If Check = Y the...
(1) odpowiedzi
2017-02-11 20:02 Searching names in PostgreSQL »
I have users table: id, first_name, last_name, ... With data: 1, John, Doe 2, Harry, Potter 3, Alex, Brown 4, James, Smith I need to make autocom...
(2) odpowiedzi
2017-02-11 18:02 Converted MS-SQL stored proc to MYSQL but now it wont create due to syntax errors »
I have a strong MS-SQL background but have never seen a line of mysql until yesterday. I need to convert my ms-sql stored proc to mysql and I thought ...
(1) odpowiedzi
2017-02-11 18:02 Optimising many-to-many query in MySQL »
I have a table called 'items' that looks something like this... id | name –––––––––––– 1 | APPLES 2 | BANANAS 3 | ORANGES...
(2) odpowiedzi
2017-02-11 18:02 How to shuffle array in PostgreSQL 9.6 and also lower versions? »
The following custom stored function - CREATE OR REPLACE FUNCTION words_shuffle(in_array varchar[]) RETURNS varchar[] AS $func$ SELEC...
(2) odpowiedzi
2017-02-11 16:02 Proper Way to Key Data Warehouse Fact Table »
When keying a FACT table in a data warehouse, is it better best to use the primary key from the foreign table or the unique key or identifier used by ...
(1) odpowiedzi
2017-02-11 05:02 how to select rows with multiple where conditions »
Not sure if the title made sense. But this what I need, I am bad at sql: I have table with the following data ID| Value ------ | ------ 1| A 1| B 1...
(4) odpowiedzi
2017-02-11 00:02 SQL: Select rows only with values separated by a given interval from other results »
Let's say that I have a table that looks like this, giving me the times of various events in seconds. event_time ---------- 11 14 18 20 25 39 42 43 5...
(3) odpowiedzi
2017-02-10 20:02 How to query for matching values accros multiple rows? »
I have 2 tables: players and tags that join through player_tags. I want to get player Aaron only if it matches 1 or more tag names. In my case I want ...
(4) odpowiedzi
2017-02-10 10:02 Why is my uncorrelated sub-query so slow? »
I have a statement which takes 10 seconds to perform on 10k items in table X: Version 1 SELECT * FROM X WHERE pk = 77843 AND (a IS NULL OR a NO...
(2) odpowiedzi
2017-02-10 09:02 SqlDeveloper - checking for NULL values without IS NULL clause - in a scripted query »
for circuit in allCircuit: # a cvs of 4 columns part = circuit.split(",") res = cur.execute("""SELECT col4 from ATable WHE...
(1) odpowiedzi
2017-02-10 08:02 Reorder rows in database »
I need to change order of rows in database table. My table has 4 columns and 7 rows. I need to reorder these rows pk_i_id int(10) unsigned Auto I...
(1) odpowiedzi
2017-02-10 04:02 SQL ORDER BY DECODE is sorting number as a string? »
I have a table of flight records created as follows CREATE TABLE FLIGHT_DETAILS ( FLIGHT_ID NUMBER(10) PRIMARY KEY, FLIGHT_NO VAR...
(2) odpowiedzi
2017-02-09 19:02 Latest records using sql »
I need to build weekly aggregated data for sales. Where TRNST_QTYis the latest available quantity of the closing week and PRCHS_QTY is the sum of purc...
(1) odpowiedzi
2017-02-09 14:02 PostgreSQL previous and next group value »
The problem is the following: Suppose, I have a table of such view (it is a sub-sample of the table I'm working with): | col1 | col2 | |------|-----...
(3) odpowiedzi
2017-02-09 10:02 Oracle extract alpha characters from string »
I want to extract only alpha characters separately. For example Output for "NIC132DA.1" should be "NIC" and "DA" separately without any numbers. I ...
(1) odpowiedzi
2017-02-09 02:02 How to represent the SQL value NULL in ActiveRecord#create calls? »
Since seeds.rb is in Ruby, I'm guessing that if I want the effect of insert into foo values (hoo: "ioo", koo: null); I should do something like Fo...
(2) odpowiedzi