sql

Deleting rows from an SQL table

There is a table with this structure COL1 | COL2 | COL3 -----+------+----- a | d | t -----+------+----- d | t | ... l | m | n You need to solve the problem using standard SQL Tell me where to start and how to organize the algorithm

How can the LISTAGG function return values without repetitions?

I'm trying to use the LISTAGG function. It is necessary to get the values of the column without repetitions. Is this possibl ... umn col1 and the list from the column col2 with the function LISTAGG. I get [2,2,3,4,5], and the desired result is [2,3,4,5].

How do I add a calculated column to a table in Oracle SQL?

There is a table with data, there is a formula for calculating the values of the last column. How do I create another column, ... in the specification for calculating this column and compare whether there are rows with different values of 3 and 4 columns

Is there a SQL Server equivalent of the IsNull() function in Oracle?

In SQL Server, you can use the function IsNull(expression, replacement), to determine whether the result of the expression is NULL, and replace it with an alternative value in this case. Is there an equivalent function IsNull() in Oracle?

How do I create a table in Oracle if it doesn't exist yet?

If you run the query " CREATE TABLE some_name", jdbc throws an exception ORA-00955: name is already used by an existing obje ... rrorException e) { if (e.getErrorCode() != 955) { throw e; } } Is this correct? Is there a better approach?

SQLite 3 doesn't see the column

import sqlite3 connection = sqlite3.connect('base.db') sql = connection.cursor() sql.execute('''CREATE TABLE IF NOT EXISTS ... code not work on my PC? The database file was created with the extension db and is located in the same directory as the code

How to make an sql query to select data that is not initially available (T-SQL)

There is a table with the date field, the records indicate the changes of employees on a certain date (Id int, ShiftDate date ... create a query that will output all the dates for a certain period of time, during which no one had a shift. In sql server.

Sql script loop

I have a table with users and I pull out all the IDs from there in the same way: SELECT UserID FROM Users Now, for each ID ... om this list, I need to perform certain operations (with other tables using these IDs) Tell me how to organize a loop in SQL

How do I save a SQL Server database in an SQL script?

There is a SQL Server database. By what means is it possible to translate it into an SQL (or T-SQL) script so that it creates all the tables itself, and so on?

PyMySQL how to make an insert?

Here is the code of my parser #Парсер v2 import requests from bs4 import BeautifulSoup import pymysql.cursors def get_ ... autocommit=True) print ("connect successful!!") How to implement data from parsing to automatically do insert

Create a multi-line request to add to the SQLite database

I want to add records to the table while checking whether there is a record with certain values in the database. I do somethi ... начение2' AS Поле2 'Значение3' AS Поле3 WHERE NOT EXISTS( SELECT NULL FROM Baza WHERE (Поле1='Значение1')) LIMIT 0,1

How to make a LEFT JOIN SQL query correctly?

Good time of day! Please tell me how to make it so that in LEFT JOIN Nacenki when Nacenki.IdPriznPartn = NULL, LEFT JOIN hav ... prTovar.KodPGr = SprPGrup.KodPGr WHERE DocStrOst.KodSkl = 325 AND DocStrOst.KolF > 0 ORDER BY SprTovar.NameT

Laravel how to link 2 tables to get the data of the first one by the id of the other table

Hello everyone. Let's say there are 2 tables - clients and payments. The client can have many payments, because here in the m ... nts of a particular client (clearly, the id characterizes a particular client). Please tell me who knows how to implement it.

How do I SELECT "dishes" by "ingredients"?

There is a table with "dishes" and their "ingredients": id title ingr 1 яичница яйца 2 ... ith the same ingredients? Input data: ['яйца', 'соль'] Output: ['яичница', 'соль с яйцами'] Http://sqlfiddle.com/#!7/386f1/3

Where can I download the Northwind database?

Where can I download the Northwind database? I rummaged through everything possible - I didn't find it.

What is the Mysql connection type?

There is a Types table: ID NAME 1 w 2 d 3 f Where ID is AUTOINCREMENT There is another USER_TYPE table that has this str ... le. It can be argued that the relationship between the Types tables and the USER_TYPE table is one - to-many? or many to one?

The request returns the error ORA-00911: invalid character

What is the request error? The request itself: CREATE GLOBAL TEMPORARY TABLE `complite_incomplite` ( `card_task_id` INT ... y? I can't run the request itself, so I pass it to another person to execute it, but I have no experience working in Oracle.

Deleting a column from a table

How do I delete a column from a SQL Server table?

Ban on deleting records

You need to prevent deleting records from the table that do not meet a certain condition by using a trigger. Without using th ... re some options can be deleted, but the rest can't, the trigger immediately throws an exception and does not delete anything.

Formulas for fields in MSSQL SERVER

Hello! How can I create a calculated field in mssql server? For example, there is [field 1] and [field 2], which should be ca ... f the first field, for example, from...to..., then field 2 will have one value, and if field 1= from...to..., then - another.