I am not an expert on databases and SQL. I am developing a dotnet core application using the Entity Framework to access a (postgresql) database. I have the following tables with the following columns: …
Tag: sql
CS50 Pset 7 13.sql, I can’t solve it, nested sqlite3 database
DataBase movies.db tables directors (movie_id, person_id) movies (id, title, year) people (id, name, birth) ratings (movie_id, rating, votes) stars (movie_id, person_id) you can download the database. Question I’m new in programming, so I decided, to begin with, CS50 Harvard course here is the problem a…
Join three selects into one
I’m using SQL Server 13.0.5102.14. I have these three selects: declare @prodID int = 1; declare @lotAI varchar(4) = ’10’; select cod.Serial as ItemNO, varData.Value as Lot, pro….
Query is taking a long time to execute [closed]
The query is taking too much time to execute. Ots comparing some condition and then fetching data accordingly. Please guide me why its happening. DECLARE @Rowcountcnzg int = 0; DECLARE @countcnzg …
How to select duplicate records for a column having Data/NULL values in other columns?
I have a table in SQL server with 2.5 M records and I want to select the unique records as in image below. Can someone help me write a select query for this? Original table and requested data:
I have query to get some data but I need different result
select to_char(a.insertdatetime) as insertdatetime , b.category, count(1) as count from daily a , server b where status != ‘OK’ group by b.category , to_char(a.insertdatetime) …
Incorrect next near when use iif with set in sql Servr
When I use a statement and set in same query, we get Incorrect syntax near ” DECLARE @Enter int DECLARE @Month INT DECLARE @year INT DECLARE @Delayed INT = NULL DECLARE @…
Query the Column based on the value of another column
Hi I have a table structure like this id-rank id name value rank 1-1 1 abc somevalue1 1 1-2 1 abc somevalue2 2 1-3 1 abc somevalue3 3 2-1 2 abc somevalue4 1 3-1 3 …
How to group by incuding UID column in the new table
I ‘m trying to group some data with the following query but I need also to add the uid column from a_import.veg table in the c_schema.worst_case table which contains unique values. As far as I know I …
Merge every 2 consecutive records into 1
I have a pre-processed table which I want to group every pair into one record containing data from fields of both records. |——————-|—–|—-| |Timestamp |Event|User| |———-…