Category "sql"

Rank actors with movies released in India based on their average ratings. Which actor is at the top of the list?

-- Note: The actor should have acted in at least five Indian movies. -- (Hint: You should use the weighted average based on votes. If the ratings clash, then t

UsageError: Line magic function `%%bigquery` not found

I am very new to Big query. I am trying to load data from a Big query table to pandas dataframe. I followed the syntax given in the documentation here. Unfortun

SQL AVG Alias with CASE

I am trying to run this query, but facing an unknown column error for Average: SELECT CAST(AVG(Lesson_CLass.T_Points) AS Decimal (10,0)) AS Average, CASE

SSMS Export Query Results to Excel or CSV

I am trying to export the results of a query to CSV and then ultimately Excel. My issue is, one of my columns has commas in it and the commas interrupt Excel

Pivot Multiple Columns in SQL

I want to pivot multiple columns like the table below: Original Table: ID ClientName RegDate Interest AMT Principal AMT 1 A 01-Sep-19 100.0

System.Data.SqlClient.TdsParser' threw an exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format

I am hosting .net core applicaton on server but when I try to run the application it throws exception in windows logs: Unhandled exception. System.TypeInitializ

Rolling 12 month Calculation SQL

I am trying to do a 12 month rolling calculation, but I get a syntax error at "rows", here is what I have so far: (SUM(YTDValue) OVER (ORDER BY PerformanceDate

Create View in SQL Server to create multiple rows for each date,with calculated date and identifier column

I need to create a VIEW/Select statement that will take a start date, and create 3 different rows for each date. One row calculates 30 days, from the start date

Display department names using Cursors.Create a PL/SQL block to display all the department names from the Department table using cursors

TABLE: Column name Data type Constraints DEPARTMENT_ID NUMBER(5) PK DEPARTMENT_NAME VARCHAR2(25) NOT NULL LOCATION_ID VARCHAR2(15) I have tried this. But stil

How can force SQL DateDiff function to stop rounding up?

I am working on a query that tries to count from an exact date to an exact date. Today is 2/16/2022. Between 6/30/2020 and 2/16/2022 19 months have gone by. My

Skipping same entries in different rows of a column in SQL table

for example I have created a dataframe in R named as "Numbers" which has following output: Numbers 1 2 3 2 4 1 When I tried to insert this dataframe in SQL tab

Exporting a hana table having 220 million records using hana Export Command

I've a Hana table having 220 million records. (Size 12GB). We currently use Informatica which performs a select * on my_table and exports a pipe separated data

Oracle SQL statement returns no rows when executed from C# application

Following SQL statement returns data when executed in Oracle SQL Developer: SELECT TC_GUID FROM TBLBUF WHERE TC_DEST = 'aaaaaaa' AND TC_STATE <= 20 but when

Teradata : Extract Date from string

There is a notation field with different number of characters. Eg Exceed Limit Fee 26-January-2020 or Account Exceed Limit Fee 05-June-2001 I want to extract

I want to create a store procedure that will create DDL,DML trigger for a selected table as parameter

Like the below trigger but I need to add update insert and delete all three. for update trigger columns dynamically getting is not able to code CREATE TRIGGER d

Show the name and the extension where the capital is an extension of name of the country from the table CITY

For example, In 'Monaco-Ville' the name is Monaco and the extension is -Ville. This problem is from SQLZOO. I am having trouble making my solution look like the

SQL using table from join in subqueries

I am writing a query to be used as databases view, it looks now like this: SELECT contact.*, contact_users.names AS user_names, contact_status.status_

PostgreSQL like-search by Korean doesn't work

Here is the specification of my PostgreSQL. PostgreSQL 12.8 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit server_encod

How do I get DISTINCT columns and COUNT occurrences of sub DISTINCT columns [closed]

I am having some difficulty building a file download statistics database and displaying the information how I would like. Table: customer_stat

ORA-02070: database %s%s does not support %s in this context

I have an Oracle database from which I am selecting a table from a remote postgres database, pg. The column mydate is of type date. select to_char(mydate,'mm-d