Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data, and a tag for the DBMS implementation (e.g. MySQL, PostgreSQL, Oracle, MS SQL Server, IBM DB2, etc.) being used. If your question relates solely to a specific DBMS (uses specific extensions/features), use that DBMS's tag instead. Answers to questions tagged with SQL should use ISO/IEC standard SQL.
I have a question regarding database connection
I am using the Apache Derby database
When I trying to connect to my database using DriverManager I am having an error
private final String DATABASE_URL ...
I have a dataset(one column , multiple rows) mentioned below. I want to transpose first 5 rows in columns - 1st row, next 5 rows in 2nd row's column and so on. Can anyone help me with SQL query to ...
asked 1 hour ago
user1254261
13222 gold badges22 silver badges1212 bronze badges
This is my ActiveRecord:
class CreateTasks < ActiveRecord::Migration[6.1]
def change
create_table :tasks do |t|
t.string :title
t.text :body
t.datetime :due
t.integer :...
asked 1 hour ago
Peter
17411 gold badge22 silver badges1515 bronze badges
How can I get data from SQL using PHP of this month (not last 30 days).
If this is January 10, I wan to collect data from January 1 to January 10.
I tried the following code, but it seems to be taking ...
Basically the task is to query data to isolate which users have a certain scope of permissions for a project.
select ssm.user_id,s.scope
from user_available_scope_sets uass
join ...
This is my query
select *
from RDR1 A
where Year(A.shipdate) = '2021'
and (
Month(A.shipdate) = Month(CURRENT_TIMESTAMP) - 1
or Month(A.shipdate) = Month(CURRENT_TIMESTAMP) + 1
or Month(...
how to select rows from a table by converting matching rows to columns within the same table and delete the row from the table. There are 4 Account number (100,200,111,222) where account number 100 is ...
I need to use SQL and Asp.net to make a system that sends the HTTP response / Request response to a site, shows the data retrieved from the SQL server and then, shows what they have received after ...
I know it may be basic, but i'm noob to SQL.
So, i have this query:
select nome_equipa,
sum(case when (resultado_visitado = resultado_visitante) and jogo.equipa_id_equipa = id_equipa or (...
I am at a loss on how to return pivoted results. Any help is greatly appreciated. My data look like this:
Notice SystemCategoryID and DataQualityCategoryID 3 has a record for 2019 and another for ...
asked 6 hours ago
obautista
2,7931111 gold badges4242 silver badges7272 bronze badges
It seems postgres supports an array-append natively with an operator:
|| array-to-array concatenation ARRAY[1,2,3] || ARRAY[4,5,6] {1,2,3,4,5,6}
Source: https://www.postgresql.org/docs/current/...
asked 6 hours ago
David542
91.1k123123 gold badges350350 silver badges606606 bronze badges
The basic idea is that I'm trying to make a new row everyday for my page views so that I can echo my daily views.
In my database I have three columns: pageid, pagehits and pagedate (the pagedate table ...
hi friends from all over the worlds, i went trough many solution in stack but halas i'm still failing at inserting my data.
my php version is 5.5.12
and here is the code of the insert:
$query = $db-...
The following queries a struct from a public data source:
SELECT year FROM `bigquery-public-data.words.eng_gb_1gram` LIMIT 1000
Its schema is:
And the resultset is:
It seems BigQuery automatically ...
asked 7 hours ago
David542
91.1k123123 gold badges350350 silver badges606606 bronze badges
Let's say we have a table of 100k transactions (each row is a purchase of product by customer at timestamp dt).
I have noticed that the query
SELECT product, COUNT(customer) FROM transactions GROUP BY ...
asked 7 hours ago
Basj
25.9k5656 gold badges214214 silver badges411411 bronze badges