## ERROR 1064 (42000): You have an error in your SQL syntax – Cannot understand what the error means

I’m trying to import an SQL db, exported from another place. I have the SQL create script. I am not sure what might be going wrong…

select version(); +----------------+ | version()      | +----------------+ | 10.5.8-MariaDB | +----------------+ 1 row in set (0.000 sec) 

Table create script:

-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: db -- Generation Time: Jan 04, 2021 at 05:59 PM -- Server version: 8.0.22 -- PHP Version: 7.4.11  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00";   /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */;  -- -- Database: mytestdb -- CREATE DATABASE IF NOT EXISTS mytestdb DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; USE mytestdb;  -- --------------------------------------------------------  -- -- Table structure for table categories --  DROP TABLE IF EXISTS categories; CREATE TABLE categories (   id int NOT NULL,   category varchar(100) GENERATED ALWAYS AS (json_unquote(json_extract(json,_utf8mb4'$.category'))) VIRTUAL NOT NULL, popular enum('true','false') GENERATED ALWAYS AS (json_unquote(json_extract(json,_utf8mb4'$  .popular'))) VIRTUAL NOT NULL,   imageUrl varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(json,_utf8mb4'$.imageUrl'))) VIRTUAL NOT NULL, json json NOT NULL, timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;  Error: ERROR 1064 (42000) at line 33: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOT NULL, popular enum('true','false') GENERATED ALWAYS AS (json_unquote(...' at line 3  ## Database error: You have an error in your SQL syntax term_taxonomy It’s been a while since this syntax error has been happening, I tried to look it up, have read articles and forum’s posts on this issue, but I still couldn’t fix it. It says I have an error on my database, but I’m afraid it might be my server. This mysql error is happening when I edit articles. I wished I could explain this better, but I have no idea of what’s going, this is what I get when I check the error log (a part or two might be odd because I translated to English): WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "...' at line 3 for query SELECT SQL_CALC_FOUND_ROWS 2u98_posts.ID FROM 2u98_posts LEFT JOIN 2u98_term_relationships ON (2u98_posts.ID = 2u98_term_relationships.object_id) LEFT JOIN 2u98_term_taxonomy ON ( 2u98_term_relationships.term_taxonomy_id = 2u98_term_taxonomy.term_taxonomy_id ) WHERE 1=1 AND ( 2u98_term_relationships.term_taxonomy_id IN (152) ) AND ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND 2u98_posts.post_type = 'post' AND (2u98_posts.post_status = 'publish' OR 2u98_posts.post_status = 'queued' OR 2u98_posts.post_status = 'processing' OR 2u98_posts.post_status = 'hold') AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND EXISTS (SELECT 1 FROM 2u98_postmeta WHERE 2u98_postmeta.post_id = 2u98_posts.id AND 2u98_postmeta.meta_key = "_wp_attachment_metadata"))) AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND EXISTS (SELECT 1 FROM 2u98_postmeta WHERE 2u98_postmeta.post_id = 2u98_posts.id AND 2u98_postmeta.meta_key = "_wp_attachment_metadata"))) GROUP BY 2u98_posts.ID ORDER BY 2u98_posts.post_date DESC LIMIT 0, 5 made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts ## Why am I getting this error: Incorrect syntax for definition of the table constraint CREATE TABLE COMPUTER_ASSIGNMENT ( SerialNumber Int NOT NULL, EmployeeNumber Int NOT NULL, DateAssigned Date NOT NULL, DateReassigned Date NULL, CONSTRAINT SerialNumberPK PRIMARY KEY (SerialNumber, EmployeeNumber), REFERENCES COMPUTER (SerialNumber), CONSTRAINT SerialNumberFK FOREIGN KEY (SerialNumber, EmployeeNumber) REFERENCES EMPLOYEE (EmployeeNumber) ); ## What is the syntax for using Reap and Sow and WhenEvent with derivative = 0 with interpolating function? I have a system of three ODEs. This system oscillates. I need to determine the frequency of each of the three solutions. My file. You can download and modify this. I’m new to Mathematica and I know this question has been asked multiple times, but I can’t get it working. {xSol, ySol, zSol} = NDSolveValue[{ode1, ode2, ode3, ic2}, {x, y, z}, {t, 0, 200}]  Plotting xSol, ySol and zSol (three interpolating functions) gives: Can anyone show me how to determine the frequency of this thing using Reap and Sow or FFT. I’ve been instructed already how to do this using EcoEvo package, but I’m also wondering how to do it without such a package. Both the Reap/Sow solution and the FFT come pretty close to what I have and need. But I fail in modifying the mentioned solutions so that it works with my code. How do I individually determine the frequency of xSol, ySol and zSol? My implementation of WhenEvent For example, when I try to use WhenEvent, I used it like this: {xSol, ySol, zSol} = NDSolveValue[{ode1, ode2, ode3, ic2, WhenEvent[x'[t] == 0, Sow[t]]}, {x, y, z}, {t, 0, 200}]  This gives me an error (which I presume to be about the WhenEvent) and my regular solutions. Because the solutions are correct, I think that the problem here is in the WhenEvent. Error: Event location failed to converge to the requested accuracy or precision within 100 iterations between t = … and t = …. All suggestions and solutions are highly appreciated! Many thanks😊 ## Understanding JOIN Syntax Given: postgres=# \d foo Table "public.foo" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- a | integer | | not null | b | text | | not null | Indexes: "foo_pkey" PRIMARY KEY, btree (a) postgres=# \d bar Table "public.bar" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- a | integer | | not null | b | text | | not null | Indexes: "bar_pkey" PRIMARY KEY, btree (a) postgres=# select * from foo; a | b ---+----- 1 | one (1 row) postgres=# select * from bar; a | b ---+----- 2 | two (1 row)  I then join‘d using the following JOIN syntax: postgres=# select * from foo, bar; a | b | a | b ---+-----+---+----- 1 | one | 2 | two (1 row)  Then, I compared it to full outer join: postgres=# select * from foo full outer join bar using (a); a | b | b ---+-----+----- 1 | one | 2 | | two (2 rows)  and cross join: postgres=# select * from foo cross join bar; a | b | a | b ---+-----+---+----- 1 | one | 2 | two (1 row)  Is it always true that the from a, b, c will produce a cross join? ## UPDATE with variables to renumber column gives syntax error Searching for a way to renumber a column within mysql, I’ve found multiple articles showing the same approach: • Renumbering an Ordering Field in MySQL • How to update a MySql column with ascending numbers among others. But trying it on my table I get a syntax error. mysql> SET @rankStart = 10; mysql> SET @rankInc = 10; mysql> UPDATE fileFileTbl SET rank = (@rankStart := @rankStart + @rankInc) ORDER BY rank ASC; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank = (@rankStart := @rankStart + @rankInc) ORDER BY rank ASC' at line 1  The command looks identical to the articles posted. What am I missing? Here’s the table (with some columns omitted): CREATE TABLE fileFileTbl ( id int(11) unsigned NOT NULL AUTO_INCREMENT, fileEngineId int(11) DEFAULT NULL, rank int(11) DEFAULT '0', fileName varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 'newfile', PRIMARY KEY (id), UNIQUE KEY fileEngineId (fileEngineId,rank) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;  System is Centos 8, with mysql as: # mysql --version mysql Ver 8.0.17 for Linux on x86_64 (Source distribution)  ## Parse error: syntax error, unexpected ‘dbp_tb_branch’ (T_STRING) in wordpress I am creating plugin which is not showing on admin menu. I don’t know what happened. <?php /* *Plugin Name:Arsh Forms *Author:Arsh Venveru * *Description:Create forms. *Version:1.0.0 *License:GPL2 *License URI:https://www.gnu.org/licenses/gpl-2.0.html */ defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); add_action('admin_menu','arsh_admin_menu_option'); function arsh_admin_menu_option() { add_menu_page('arsh-form-table','arsh-Forms-Table','manage_options','arsh-admin-menu','arsh_form_table','dashicons-thumbs-up',40);} function arsh_form_table(){ wp_enqueue_style('shortcode_table1','https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css'); wp_enqueue_script('shortcode_table','https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"'); wp_enqueue_script('shortcode_table','https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js'); wp_enqueue_script('shortcode_table','https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js');$  content=''; $content .='<div class="wrap">';$  content .='<div class="container">';   $content .='<h2>VENVERU FORMS</h2>';$  content .='<table class="table table-striped">';     $content .='<thead>';$  content .='<tr>';         $content .='<th>Sr.no</th>';$  content .='<th>Form Name</th>';         $content .='<th>Form Id</th>';$  content .='</tr>';     $content .='</thead>';$  content .='<tbody>';       $content .='<tr>';$  content .='<td>1</td>';         $content .='<td>Venveru-Form</td>';$  content .='<td>[Registeration-Form]</td>';       $content .='</tr>';$  content .='<tr>';         $content .='<td>2</td>';$  content .='<td>Display-Entries</td>';         $content .='<td>[Display-Reg-Form]</td>';$  content .='</tr>';       $content .='<tr>';$  content .='<td>3</td>';         $content .='<td>Add-branch</td>';$  content .='<td>[Add_Branch_Form]</td>';       $content .='</tr>';$  content .='<tr>';           $content .='<td>4</td>';$  content .='<td>Display-Branches</td>';           $content .='<td>[Display-Branches]</td>';$  content .='</tr>';       $content .='<tr>';$  content .='<td>5</td>';       $content .='<td>Login page</td>';$  content .='<td>[Login_page]</td></tr>';       $content .='<tr>';$  content .='<td>6</td>';       $content .='<td>Add Book</td>';$  content .='<td>[add_book]</td></tr>';       $content .='<tr>';$  content .='<td>7</td>';       $content .='<td>Teacher Reg</td>';$  content .='<td>[Teacher_Reg]</td>';     $content .='</tr>';$  content .='</tbody>';   $content .='</table>';$  content .='</div>'; $content .='</div>'; return$  content; } add_action('wp_enqueue_scripts','arsh_form_table'); 

How can I solve this error?

## Another syntax for Anydice mechanic question

I’m trying to build a function to model not just a roll of the dice, but to have boolean operators to toggle using various powers that effect the dice. I’ve gotten everything to work except for one thing- looking at the result of the roll, seeing if a ‘1’ was rolled and then changing that ‘1’, but only once.

The dice mechanic is for Cryptomancer, and it works by takinging your rank in a skill which is 1 to 5 and rolling that many d10’s plus a number of d6’s that total to 5 dice. For d10s, 1’s are always botches (-1), numbers under the target number are 0’s and numbers equal to or greater the target are successes (+1). On the d6’s 1s are botches, 6s are success and everything else is 0.

I’ve been using custom die for my rolls but set the function up to build the roll off just a skill number and challenge number. Here’s what i got so far-

function: sb B:n sp P:n skill SKILL:n vs CHALLENGE:n{ if P=1{ ROLL: SKILLd{-1,0:(CHALLENGE-2),1:(10-CHALLENGE),2}+(5-SKILL)d{-1,0:4,1} } else { ROLL: SKILLd{-1,0:(CHALLENGE-2),1:(11-CHALLENGE)}+(5-SKILL)d{-1,0:4,1} } if B=1{ if 5@ROLL=-1{ ROLL:ROLL+2 } } result:ROLL }

The goal is that you can toggle things by entering a 1 or 0 for the values B and P to turn them on or off. P=1 makes all ’10s’ rolled be worth +2 success instead of +1. B=1 is suppose to check the last value of the roll, and if a -1 is present add 2 to the whole total, there by turning one and only one botch into a success, even if there are multiple botches in the roll.

Everything works till i turn on B. then i get an error that the boolean operation if can only be used on numbers. Turns out 5@ROLL isn’t giving me the lowest roll of 5 dice but the probability of what that roll will be. How do i fix this? How can i convert ROLL:d into ROLL:s?

## How many syntax trees can be made by a BNF

An example of this would be:

1+2*3+4

Expression = Expression Arithmetic Expression | number

Arithmetic = + | – | * | /

Through just breaking down 1+2*3+4, it was easy to find that the answer was 5 trees.

1. 1+((2*3)+4)
2. ((1+2)*3)+4
3. 1+(2*(3+4))
4. (1+2)*(3+4)
5. (1+(2*3))+4

But doing it in this brute force manner wouldn’t work on larger more complex BNFs.

I have tried using CYK to get 5 but haven’t figured out how, even through they do seem similar enough. Any advice on using any algorithms or strategies to break down larger BNFs to see how many syntax trees they can make would be much appreciated.

## Counting the number of unique syntax trees of a grammar

Lets say we have some arbitrary grammar for which we would like to know how many different syntax trees does it generate. For example the following:

S -> A1|1B

A -> 10|C

B -> C1 | $$\varepsilon$$

C -> 0|1

This is a quite simple language and the number of unique trees is not hard to figure out by just going through all of the different possibilities, but for more complex languages it gets difficult to count the number of unique trees by just examining it. For this reason, I’m wondering if there does exist some analytical approach, rules of thumb, or software that would allow to count the number of unique trees faster than just looking at the language long enough until all the possibilities are exhausted?