Category "sql"

Can I have multiple INSERT statements following the same WITH statement [duplicate]

I am defining a new WITH statement as newStaff, and then I am taking that data and filling it into other tables. It doesn't seem to let me ref

HIVE CBO. Wrong results with Hive SQL query with MULTIPLE IN conditions in where clause

I am running one SQL query in Hive and it gives different results with CBO enabled and disabled. The results are wrong when CBO is enabled (set hive.cbo.enable=

How do I ignore null values in t-sql function?

I am doing an outer join between two market data tables. The two tables have trading volume reported differently, therefor I need to query them separately and t

MS Access 2016 decrypt field that is encrypted in linked ODBC SQL Server table

I need to encrypt SSN (nvarchar(25)) field in a SQL Server database table. Once encrypted, the Access program needs to be able to decrypt the field for user vi

How to query an Entity from a Many-to-Many realtionship dependendt on two ore more conditions in Ktor with the Kotlin Exposed Framework?

I have 3 entities: User id: Int name: String Room id: Int name: String RoomUser id: Int room_id: Int (Reference on Room.id) user_id: Int (Reference on User.i

GBQ Execute Immediate into a CTE

I am building an application/script for users that do not have write access to the database. Normally I would use Execute Immediate and save that result into a

pandas non equi join in range

I need to do 'pandas non equi join', when first table joined with second table in range. first_table EMPLOYEE_ID SALARY 100 3000.00 101 17000.00 102

Select and join returning duplicate data

I have some tables that can be accessed here and I would like to get a new table with EntryId from Entry table and ProtocolNumber from JudicialOrder table. For

sqlsrv_num_rows resule Warning: sqlsrv_num_rows() expects parameter 1 to be resource, boolean give [duplicate]

$results = sqlsrv_query($dbconn, $query2, array(), array('Scrollable' => 'static')); if (sqlsrv_num_rows($results) >= 2) { $query3 =

shortest and longest city name

Query the two cities in STATION with the shortest and longest CITY names, as well as their respective lengths (i.e.: number of characters in the name). If there

SQL query returns result multiple times

I'm pretty new to SQL and am trying to join some tables in SQL. I'm using SQLite3 and Pandas and have the following table structure: User | Measuremen

SQL query returns result multiple times

I'm pretty new to SQL and am trying to join some tables in SQL. I'm using SQLite3 and Pandas and have the following table structure: User | Measuremen

TSQL Subquery in from

I am attempting to do a subquery which should work but I am missing something in the syntex. I am trying: select * from (select * from (select *, row_number

ERD - Recursive relationship with two primary keys

I have a product table: Product (ID, Version) And I am having trouble creating a recursive table named "Update". this table should have a product ID and for eac

How do you use a JSON array in a "WHERE IN" clause in MariaDB

I am using MariaDB version 10.2 I have an array of GUIDs stored as JSON in a table and I want to select rows from another table where the ID matches any of the

org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "drop table if exists [*]user CASCADE "; expected "identifier"; SQL statement:

I've below data.sql file in my src/main/resources/data.sql file. I would like user tabel to be created from user.csv file. DROP TABLE IF EXISTS `USER` CASCADE;

Oracle SQL Trigger: After Update, Insert Rows into Another Table

I am trying to write a trigger on one table that is triggered when the quantity in stock = 0. It will then add a row to another table with the product_id and st

How can I display the header of columns of all tables within a SCHEMA

I would like to list out all the tables and column headers within a SCHEMA to be displayed in Rows within MySQL, I can't seem to find an answer online and would

Change Two Rows Into Two Columns

Oracle newbie here just trying to learn something. I have a query that returns two rows per ID: SELECT B1_ALT_ID, B1_CHECKLIST_COMMENT FROM PERMIT WHERE (B1_CHE

Make a Report that Can Edit another Report in APEX

I have multiple report pages. I am working on a system that stores a lot of data. Is it possible to have reports that are able to have column edited on two diff