Get Answers to Your Coding Questions
I have the query and table below, how do I select the 1st line of each category of column TeamboardId? SELECT * FROM Job WHERE HandLingTimeSeconds = '60' JobId TeamboardId 1 1 2 1 3 1 4...
I am trying to develop a query in Postgis, where it can solve this problem: I have a geometry and I wanna know which of the polygons that touches it, there is the highest contact area of this geometr...
I've a table teams with 30 rows and has a handful of statistics stored as attributes. For example, goals for, goals against, etc and I've created a view that uses rank() and does a good job ranking th...
I have a table where i have user_id, item_id , profit_date and profit as a column. what i want is avg profit, maximum profit and latest profit for each user and item. i am able to find max and avg but...
Is there a way to restrict certain tables from the mysqldump command? For example, I'd use the following syntax to dump only table1 and table2: mysqldump -u username -p database table1 table2 > dat...
I have a lot of character varying records in this format: {'address': 'New Mexico'}. I would like to update all those columns to have it like this: New Mexico. I've been investigating how to do it, an...
This is my JDBC file with a the following sql query: private static final String UPDATE_QUESTION = "UPDATE Quiz SET type=?, questionIndex=?, choiceNum=?, question=?, choiceA=?, choiceB=?, choiceC...
I am going to financial data of peers of a company. I have 10 peers for a particular company and the financial data is captured at regular intervals (monthly, quarterly, etc). However since the data c...
I'm programming a script using PHP and MySQL and I want to get a unique id (consisting of a string: capitals and small letters with numbers) like: gHYtUUi5b. I found many functions in PHP that can g...
I have a table with comma-separated values in it. I need to split that values into their respective columns. The values can be any number starting from 1 to 10. For example, the value '1,3,4' should s...
Here is my ER diagram. If I know the user_id, how can I get a single user's user data=>projects=>boards=>posts using a single SQL query? I have found out about recursive CTE, but all of the...
I have three SQL server instances on my computer. How can I find out which is the default one? var conn = new SqlConnection("Data Source=.;Initial Catalog=SampleDb;Integrated Security=True")...
I'm trying to write a SELECT statement that first joins two tables and then filters rows, by keeping the max value per group. Example The following two tables describe visitors in a zoo. visitors tab...
I have a table called device_data that looks like below Column | Type | Collation | Nullable | Default ----------------+-------...
I have a select that returns a table such as: weekOfTheYear mostRepeatedID 01 a 01 b 01 a 02 b 02 b 02 a and what I need is: weekOfTheYear mostRepeatedID 01 a 02 b...
I want to perform a fill-down activity in PgSQL DDL: create table brands ( id int, category varchar(20), brand_name varchar(20) ); insert into brands values (1,'chocolates','5-star') ,(2,null,'dairy...
I have the following table: Rows Decimals First 1.1.1.3.2 Second 16.1.1.1.89.1 Third 3.1.1.1.177.2 Fourth 1.1.1.1.178.3 I only want to return the rows where the second to last decima...
I have a MERGE scenario with an ARRAY_AGG() function in the main script. Once I have a match I'd like to combine the arrays from the source and target table but don't want to add existing values. I've...
I have a table in a with the following structure: CustID --- DateAdded --- 396 2012-02-09 396 2012-02-09 396 2012-02-08 396 2012-02-07 396 2012-02-07 396...
There are two tables with similar contents.I need to join them on the key 'id' to compare the value.They look like below: table_A id item_name item_value 1 cost 1.00 1 price 3...
I have table1 with the following data : ID Name Date 1 Paul 01-11-2020 1 Paul 03-11-2020 and have table2 only with a Date column: Date 02-11-2020 I want to get output from th...
I'd like to write a SELECT statement that uses just one test to return columns with no value (null, empty, or all spaces). I thought this would work: SELECT column_name from table_name WHERE column_...
In my database (MySQL) table, has a column with 1 and 0 for represent true and false respectively. But in SELECT, I need it replace for true or false for printing in a GridView. How to I make my SEL...
I have a rails model with two attributes, one is a datetime field and the other is an integer. I'm trying to add a scope using both these fields & it gives me incorrect results. ModelName.where(&q...
I have 100 columns in a table and I want to list 99 columns except a particular one. How to exclude that columns name?
I am trying to query an on-premises SQL Server database using a power automate variable. Is there any suggestions or is this even possible for the time being? I have attempted the following: Using “E...
I want to get the quarter and year depending on the sysdat in Oracle sql. For example i want expected result value as 2022q3 for current quarter. I can get the quarter using below query: select to_ch...
Is there a way to show the SQL that Django is running while performing a query?
I have a table named orders in a Postgres database that looks like this: customer_id order_id order_date price product 1 2 2021-03-05 15 books 1...
I have the following problem: I have to create table with projects and employees. Employee can be assigned to few projects, but he cannot be assigned twice to the same projects. How can I prevent doin...