Skip to main content

Questions tagged [sql]

Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data, and a tag for the DBMS implementation (e.g. MySQL, PostgreSQL, Oracle, MS SQL Server, IBM DB2, etc.) being used. If your question relates solely to a specific DBMS (uses specific extensions/features), use that DBMS's tag instead. Answers to questions tagged with SQL should use ISO/IEC standard SQL.

-2 votes
0 answers
19 views

Need to finalize the solution with SQL code

The problem is that for some reason my cat is not working correctly and I don’t understand the reason for this I think I took into account all the conditions Could someone please help me with the ...
David Zakharyan's user avatar
-1 votes
0 answers
10 views

Why I am getting Missing From Keyword error in the following code?

The cancellation rate is computed by dividing the number of canceled (by client or driver) requests with unbanned users by the total number of requests with unbanned users on that day. Write a ...
Shivani Tiwari's user avatar
1 vote
1 answer
30 views

SQL not allowing deletion of related data

In SQL I have: CREATE TABLE Customer( cust_id INT NOT NULL PRIMARY KEY CHECK (cust_id > 0), full_name TEXT NOT NULL, phone TEXT NOT NULL, ...
Moran's user avatar
  • 11
0 votes
0 answers
16 views

first 2 makes query slower than when I use first 1 in sql query in informix database

I have a query on a huge table (126738484 records) on an informix database server; this query returns only one record. when I use "first 1 " in the select statement, it runs quickly but ...
Saina Mohamadyari's user avatar
-1 votes
0 answers
20 views

ER_BAD_FIELD_ERROR in SQL

CREATE DATABASE IF NOT EXISTS RAIL; USE RAIL; CREATE TABLE IF NOT EXISTS train ( t_id INT NOT NULL AUTO_INCREMENT, t_rating INT NOT NULL, t_name VARCHAR(20) NOT NULL, t_price INT NOT ...
Harsh's user avatar
  • 11
0 votes
1 answer
13 views

laravel Eloquent ::has() QueryException on different connection

I have two databases, db1 : users table db2 : infos table Each table I created has a Models, and I set a different connection for each one: User.php => protected $connection = "db1"; ...
none's user avatar
  • 45
-3 votes
0 answers
25 views

Check if a table has any records [duplicate]

Considering a situation to check whether a table has any records or not, Is there any difference in the performance or execution speed among the two following queries? If yes, what is the logical ...
Amir Monfared's user avatar
0 votes
2 answers
41 views

Using arrays in `WHERE IN` statements

There are the following table structures and data: CREATE TABLE t_source_category ( id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, label varchar(255) NOT NULL, path varchar(255) NOT NULL, ...
SageJustus's user avatar
-2 votes
1 answer
29 views

Why does this SQL command give the error "Unknown statement type"? [closed]

I'm new to SQL and do not really understand why this: INSERT INTO users (highscore); VALUES ('1'); gives me an error. Why does this not work? I'm trying to save my high score in the database so I can ...
GeistFan's user avatar
-4 votes
0 answers
38 views

Spotting missing (null) rows in a table

I have three tables: Guests Meals Dates Most guests place three orders a day within a week period which is set up as a CTE with the following code: with Dates(Date) as ( select cast(@date1w as ...
Dan's user avatar
  • 49
-4 votes
1 answer
44 views

How do I split a string with inconsistent data?

I have some imperial distances (miles/furlongs/yards) in a column which I am looking to convert into just furlongs. However, the data is inconsistent. Sometimes there is a furlongs value, sometimes ...
UKJonA's user avatar
  • 1
0 votes
0 answers
33 views

How do I generate rows of predefined values from a SELECT statement? [duplicate]

In SQLite I want to return a list that I type in myself (for further left join SQL commands): ABC DEF GHI Not existing in any table but manually entered strings (like how SELECT 'ABC' returns ABC, ...
Eric F's user avatar
  • 919
1 vote
1 answer
29 views

SQL query to update duplicate data

I had a bug in my code which created a lot of new users with the same email (id was the PK), and this caused my Usage table to save data of the new ID that was created. User table: user_id | ...
laskdjf's user avatar
  • 1,182
0 votes
1 answer
23 views

How To use QSqlQuery::bindValue

I have this snippet : int id = m_AddItemCandidate->getId(); QString s = "INSERT INTO studied_substantives (subst_id, no_singular, no_plural, meaning) "; s = s + "VALUES(:id,...
Alain Bertrand's user avatar
1 vote
1 answer
26 views

How to use one PS dataset in a WHERE-OBJECT of another dataset

I have been using PS for about 10 years. Today I am stuck with finding a solution to a problem where I want to have items used in a WHERE-Object loaded from a SQL table. From what I have read, I need ...
veeduber's user avatar

15 30 50 per page
1
2 3 4 5
44852