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.
I want to search a text from all my database stored procedures. I use the below SQL: SELECT DISTINCT o.
What is the easiest way to save PL/pgSQL output from a PostgreSQL database to a CSV file? I'm using Pos
I want to add a row to a database table, but if a row exists with the same unique key I want to update the row
What is the main purpose of using CROSS APPLY? I have read (vaguely, through posts on the Internet) that cros
For simplicity, assume all relevant fields are NOT NULL. You can do: SELECT table1.this, table2.that, ta
I have a database with account numbers and card numbers. I match these to a file to update any card numbers to
How do I parameterize a query containing an IN clause with a variable number of arguments, like this one? SEL
I am trying to insert some text data into a table in SQL Server 9. The text includes a single quote '. Ho
There is a table messages that contains data as shown below: Id Name Other_Columns ----------------------
Is there a way to make an Oracle query behave like it contains a MySQL limit clause? In MySQL, I can do this:
How do I query an Oracle database to display the names of all tables in it?
Both these joins will give me the same results: SELECT * FROM table JOIN otherTable ON table.ID = otherTable.
What is the best way to get IDENTITY of inserted row? I know about @@IDENTITY and IDENT_CURRENT and SCOPE_IDE
I understand the point of GROUP BY x. But how does GROUP BY x, y work, and what does it mean?
Using MySQL, I can do something like: SELECT hobbies FROM peoples_hobbies WHERE person_id = 5; My Output:
How can I reset the AUTO_INCREMENT of a field? I want it to start counting from 1 again.
Good Overviews Generally speaking, you're making a decision between fast read times (for example, nested