Questions tagged [syntax]

The set of rules that define the combinations of symbols that are considered to be correctly structured for that language.

21 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
92 views

Relational Algebra: how to express the combination of aggregation and projection?

Here I have a table, I would like to query the average salary of departments, the SQL statement should be select dept_name, avg(salary) from employee I try to express this SQL in relational algebra....
2
votes
1answer
33 views

Consults and counts in multiple databases

I'm not very familiar with mysql advanced queries, because I'm more of a designer as a developer. My problem - I have 3 tables: Clients ------------------------------------------------------ | id | ...
1
vote
1answer
27 views

MySQL Row Constructor forms in INSERT VALUES vs. VALUES

In MySQL 8, based on my reading of the documentation, INSERT VALUES accepts row constructors in the form: INSERT ... VALUES(1,2,3), (4,5,6), (7,8,9); or INSERT ... VALUES ROW(1,2,3), ROW(4,5,6), ROW(...
1
vote
0answers
16 views

Why did Codd, et al. prohibit intermediate scalars in SELECT - and how would they have recommended avoiding syntactic repetition?

(I'm asking this because I was reviewing this older question I asked and because I'm currently writing some queries and getting annoyed at how much I need to repeat myself). In ISO-compliant SQL ...
1
vote
0answers
213 views

Syntax error while using variables in stored procedure

This might look like a silly question so pardon me. I was trying to write a trigger in mysql and am constantly getting #1064 which, I believe is a syntax error. Here is the sql for the trigger: ...
1
vote
1answer
53 views

Creating a MySQL function gives an error

This is the error after running this script: MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use ...
1
vote
1answer
95 views

Translate SQL Server update statement to MySQL

I have a development environment with MySQL and a production environment with SQL Server. This update statement works with SQL Server: UPDATE THIS SET <list_of_column_assignments> FROM <...
0
votes
1answer
3k views

Incorrect syntax near the keyword 'WHERE' - SQL Server 2014

The error I get is Incorrect syntax near the keyword 'WHERE'. Script: SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[msp3_account_login] @LOGINID nvarchar(50), ...
0
votes
0answers
20 views

What is an equivalent MySQL function to match CRYPT of PostgreSQL?

In PostgreSQL there is a function that can be used to encrypt passwords, like so: crypt('123456', gen_salt('bf')) What would be an equivalent function for MySQL? Background I am amending code that ...
0
votes
1answer
11 views

Counting number of occurrences, how to "group by"

I have the following query, which works as intended. Database is Sybase SQLAnywhere, which follows t-sql syntax for the most part. I'm trying to add a column to COUNT the number of times each "...
0
votes
0answers
30 views

MySQL - Year Over Year - Query Syntax

Experts I am working on a query to get Year over Year data comparison from current year to prior year. For example, if current year is Jan 1st - now, I would calc that dynamically in my query but ...
0
votes
1answer
47 views

What is the default column name given to a TABLE() type with a single column

CREATE OR REPLACE TYPE MISSING_KEYS AS TABLE OF VARCHAR2(256); SELECT [¿what goes here?] as missing_key FROM TABLE (MISSING_KEYS('A','B','C','D')) What is the default column name that should be in [¿...
0
votes
0answers
20 views

Is it possible to create an SQL transaction that rollbacks on syntax errors?

In may day-to-day job, I often have to create SQL files containing minor changes (no DDL operation usually) in order to migrate those to production databases easily. The problem is, even with syntax ...
0
votes
1answer
144 views

Set the file name in "SELECT ... INTO DUMPFILE"

I am trying to write a query to dump a single LONGBLOB data into a file. SELECT data FROM table WHERE id = 123 INTO DUMPFILE fileName which data, fileName, and id are the fields in the table. SQL ...
0
votes
1answer
226 views

Syntax error in simple trigger

I have a SQLite table with these fields among others Fld_QuoteNumberRoot string Fld_Revision integer Fld_QuoteNumber string I need to fill ...
0
votes
1answer
2k views

phpMyAdmin trigger error

The following oddly does work, but shows an error in PhpMyAdmin... (see image below) (in the definition block as seen in the image) BEGIN SET NEW.expiry = DATE_ADD(NOW(), INTERVAL NEW.duration ...
0
votes
1answer
40 views

Syntax for using Oracle Linked Server with USE keyword

I am working on a task where some tables from Oracle Peoplesoft have to pulled into SQL 2014. The concerned person gave me the following code and I see that in the end he mentions the comment Use /* ...
0
votes
2answers
34 views

How do I write a query that inserts values while AND gets values from another table?

I have a table (Tbl2) that needs to be populated with values from another table (Tbl1). Tbl1 has columns: id (uuid), name, address, gender. Tbl2 has columns: id (uuid), org, name, address, gender, ...
-1
votes
1answer
313 views

SUM first consecutive rows only SQL Server

I have the following data: ROW SEGMENT ORDEN LONG 1 39 11 49.00 2 39 10 102.00 5 39 7 104.00 6 39 6 139.00 7 39 5 97.00 11 39 1 ...
-1
votes
2answers
595 views

check syntax errors on mysql dump file

I have an issue to check syntax error on MySQL dump file. Please inform me a tool or command to check syntax on MySQL dump file. Thank You.
-2
votes
2answers
1k views

MySQL Join two tables with comma separated values

I've got two tables as below: CARLINE option_value option_name tipologia_auto_1 Citycar tipologia_auto_2 Berlina tipologia_auto_3 SUV Hobby_1 football Hobby_2 Basket Datimarketing (is the ...