Category "sql"

Conditions (like "like") on binary field (blob) in oracle

How can I search in (put condition on) blob field in oracle, like text fields? I need someting like: select * from table_name where blob_field like '%00ff00ff

To take out those dept who has no employees assigned to it

I want to write an sql query , and want to get the dept name from DEPT table who has no employees assigned in EMP table. Table Structure: EMP EMPNO ENAME

Join the same table temporary table in MySQL

I like to join a temporary table in MySQL which fails, the idea quite simple: CREATE TEMPORARY TABLE temp_table LIKE any_other_table; -- srsly it does not matt

phpMyAdmin Accepts NULL in the NOT NULL field

I've created a table with some NOT NULL columns using phpMyAdmin. CREATE TABLE `TEST` (`ID` INT PRIMARY KEY AUTO_INCREMENT, `Firstname` V

Short-circuit UNION? (only execute 2nd clause if 1st clause has no results)

If I do: SELECT * FROM A WHERE conditions UNION SELECT * FROM B WHERE conditions I get the union of the resultset of query of A and resultset of

Grouping into interval of 5 minutes within a time range

I have some difficulties with mySQL commands that I want to do. SELECT a.timestamp, name, count(b.name) FROM time a, id b WHERE a.user = b.user AND a.id =

Connection to SQL DB with Cypress

I'm trying to connect with SQL db using cypress followed the NPM guide . All the dependencies are exactly as mentioned but on running this cy.sqlServer('SELECT

Connection to SQL DB with Cypress

I'm trying to connect with SQL db using cypress followed the NPM guide . All the dependencies are exactly as mentioned but on running this cy.sqlServer('SELECT

SQL Server Maximum rows that can be inserted in a single insert statment

I want to do a batch insert, similar to this question How to do a batch insert in MySQL What is the limitation is SQL Server on how many rows can be inserted

How to Dynamically Name Table in Oracle SQL Select Statement?

i would like to return all rows and fields from a table, where neither the tablename nor the fieldnames are known in advance. Something like: select * from [TA

Query returns function plus the value inside instead of just the value

I'm running a select query and for fetching date and time data from the database but for some reason the returned value is datetime.date(2021, 11, 18) and datet

Check the perm 'Create Database' in PostgreSQL as well as in SQL Server

I would like to check the perm in PostgreSQL db as well as I do it via this command 'SELECT HAS_PERMS_BY_NAME(NULL, 'DATABASE', 'CREATE DATABASE')' for the SQL

Warning: sqlite_query() expects parameter 1 to be resource, string given

I've looked all over the place and cant find a solution that helps my case. I hope someone can help? I have this and receive Warning: sqlite_query() expects pa

Using VBA to query a SQL Server table in Excel

I'm trying to query a table in Microsoft Excel using VBA. I've written up some code to try and accomplish this task, but I keep getting an error: run-time e

Update table values from another table with the same user name

I have two tables, with a same column named user_name, saying table_a, table_b. I want to, copy from table_b, column_b_1, column_b2, to table_b1, column_a_1, c

recursive tree as a list (array items) in a new attribute value child

How to get hierarchy data(recursive tree) as a new column like below? (if there is last child then column child array is empty) rows: [{ 'id' : 1, 'paren

Update button in datagrid, entity framework WPF Application

I'm attempting to create an update button, that you can press to automatically update a record within a DB. the update button opens a new dialog, which then all

Mapping columns in a DataTable to a SQL table with SqlBulkCopy

I would like to know how I can map columns in a database table to the datatable in c# before adding the data to the database. using (SqlBulkCopy s = new SqlBul

How to return NULL when result is empty?

I have a simple query that selects one field and only one row, thus one value. Is there any way to make it return NULL if the query results in an empty set? In

Postgresql Multiple counts for one table

From two columns in my table I want to get a unified count for the values in these columns. As an example, two columns are: Table: reports | type