Tags:

Find all Asian cities whose population is greater than population of every single Nordic country (attribute region)


I’m doing a task where I’m supposed to find all Asian cities whose population is greater than the population of every single Nordic country (attribute region). (The diagram is shown on the uploaded …

Tags:

How to select all rows that are related to satisfied condition in ms ACCESS


I have the following data in table VehiclesAccSummary: I am not sure how to do this but what I want is a query that would return all rows where there where only two car in the accident and it was a …

Tags:

Why does this conversion to date fail on some rows in my table and not other rows when I use an IIF


I have this table and data: CREATE TABLE dbo.tBadDate ( BadDateID int NOT NULL, StartDate nchar(20) NULL, CONSTRAINT [PK_tBadDate] PRIMARY KEY CLUSTERED ( [BadDateID] ASC ) ); …

Tags:

create a composite unique key constraint with only the year part of date


I have a composite unique constraint that I need to implement to my table, it contains these columns: N, year (part of DATE_), ID_OPERATION. The code I tried to write was not correct ALTER TABLE …

Tags:

SQL that also gives the table names from which the columns were derived


There is a need in the SQL code below will also get the table name from which the column was fetched to maintain a lineage for analysis at later point. I need suggestion to implement such a SQL: …

Tags:

How to add the missing months name to the sql table in sequence by checking the previous month name?


I want to add the missing months to the table. If the current row having missing month then it should check the previous row and the name of the month in that row and add the next month in the current …

Tags:

‘Case ‘ inside a ‘group by ‘ clause in SQL Server


I am beginner in SQL Server, I want to write the following query in T-SQL, and I can’t find out how to do it SELECT SUM(PROSPECTS), MARQUE, LANGUAGE FROM USERS CASE Marque IN (0, …

Tags:

Alter table and add constraint not null based on another column condition


I have this table: CREATE TABLE tb_athlete ( athlete_id CHARACTER(7) NOT NULL, name CHARACTER VARYING(50) NOT NULL, country CHARACTER(3) NOT NULL, substitute_id CHARACTER (7), …

Tags:

How to merge recordsets with different fields


In SQL, union can be used to append the rows of a recordset (table or query) to another one with the same fields. You can also append recordsets with different fields by combining the fields of both …

Tags:

ASP.NET MVC: Method-Based LINQ Query of SQL Db as IEnumerable object [closed]


I am trying to query a database for all its record into an IEnumerable object. Here are the relevant codes: Db Context Snippet namespace WebApplicationTemp.Data { public class CSVMetaDbContext : …