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.

Filter by
Sorted by
Tagged with
-17votes
1answer
161views

Subquery returned more than 1 value. wrong if statement [closed]

if condition equal to true then I would like multiplication (od.price * od.kilo), and then bring the other fields else I would like multiplication(od.quant * od.price) and then bring the other ...
user avatar
-20votes
3answers
237views

SQL duplicated rows selection without using "having"

I have this type of table: A.code A.name 1. X 2. Y 3. X 4. Z 5. Y And i need to write a query that gives me all ...
user avatar
  • 11
-25votes
3answers
2kviews

Can storing wildcard strings in a column (to be used with LIKE operator) cause unexpected query results or security issues?

Could storing wildcard strings in a table's column (to be used as the second operand of the LIKE operator in queries) cause any non-obvious behavior? I'm wondering especially about the possibility of ...
user avatar
  • 18.6k
-28votes
2answers
568views

How to find difference between two values in one column by cross referencing against values in another column

I have a table that looks like this: id | machine | date | status ---------------------------- 1 | 1 | 01-01-2009 | New 1 | 1 | 01-01-2010 | Busted 1 | 2 | 01-01-2010 | New 1 | 1 | 01-01-2012 | ...
user avatar
-37votes
2answers
1kviews

When using with SAVEPOINT and ROLLBACK , what will be the output of this?

I want to answer for this SQL statement. INSERT INTO CUSTOMER (customerid,customername) VALUES(1,'alpha'); INSERT INTO CUSTOMER (customerid,customername) VALUES(2,'beta'); SAVEPOINT s1; INSERT INTO ...
user avatar

15 30 50 per page