mysql-workbench

SQL Query works in workbench but gives syntax error in java

余生颓废 提交于 2019-12-25 01:47:00
问题 I ran the query in both sql Workbench and in the executeUpdate() method in java: in Workbench: INSERT INTO recentsearches (name) VALUES ("blah"); in java: statement.executeUpdate("INSERT INTO recentsearches (name) VALUES (\""+name+"\"")); Assuming name = "blah". But I get a syntax error from running the query in java, I've already checked the string value for name. It definitely comes up as "blah", and I didn't forget the speech marks around string values, yet I still get a syntax error. The

How to update primary key?

佐手、 提交于 2019-12-25 01:22:01
问题 I am writing a script that has to update some rows without changing the contents of another script that creates a few tables. Another condition is that you cannot alter or drop constraints. Contents of Create table script: CREATE TABLE TRUCK( REGNUM VARCHAR(10) NOT NULL, CAPACITY DECIMAL(7) NOT NULL, WEIGHT DECIMAL(5) NOT NULL, STATUS VARCHAR(10) NOT NULL, CONSTRAINT TRUCK_PKEY PRIMARY KEY(REGNUM), CONSTRAINT TRUCK_STATUS CHECK (STATUS IN ('AVAILABLE', 'MAINTAINED', 'USED')); and there are

Query takes a very long time to execute

て烟熏妆下的殇ゞ 提交于 2019-12-25 00:54:53
问题 I have a query that I am trying to execute at the moment but after letting it load for a few minutes I am thinking there is probably something I am doing wrong. Here is what I am trying to execute: SELECT * FROM open_hours INNER JOIN open_times ON open_hours.id = open_times.open_hour_id INNER JOIN off_peak_times ON open_hours.id = off_peak_times.open_hour_id; I have three tables: open_hours: Roughly 14k rows id; owner_type; owner_id; seats; time_interval; max_at_one_time; created_at; updated

Mysql Workbench integer datatype bug(INT changes > (11) )

廉价感情. 提交于 2019-12-24 21:00:17
问题 When I set a "INT" datatype of a column, It's looking like this "(11)" on Mysql Workbench alter table. So I can't set auto increment, foreign key... But There is no issue for enter a data like integer. Is that a bug? Mysql Workbench Version: 6.1 (6.1.4.117773 build 1454) OS: Windows 7 64 bit Mysql Server Version: 5.6 回答1: I assume aleblebi is a Turkish member. But I suppose, the problem can be seen on other locales too. First I will try to explain the problem and then I will write my solution

Forward Engineering to SQL Server from MySQL workbench?

会有一股神秘感。 提交于 2019-12-24 17:24:46
问题 Is possible to forward engineer to SQL Server from MySQL workbench? 回答1: Not in a straightforward way. Youd need to create a MySQL schema, then use some tool to convert it to MSSQL one. 回答2: Choose forward engineer from the database menu, copy the SQL script it shows you, modify it to make it MSSQL compatible and run it on your MSSQL server. 来源: https://stackoverflow.com/questions/3391130/forward-engineering-to-sql-server-from-mysql-workbench

OS errno 13 - Permission Denied MySQL Server

自闭症网瘾萝莉.ら 提交于 2019-12-24 12:08:28
问题 I'm having issues with MySQL workbench - I can't seem to start the server. In the command line, I navigate to: C:\Program Files\MySQL\MySQL Server 8.0\bin\ And then run mysqld --initialize I get the following error: mysqld: Can't create directory 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno 13 - Permission denied) 2018-12-10T23:18:55.211840Z 0 [System] [MY-013169] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as

Incorrect usage of spatial/fulltext/hash index and explicit index order on MySQL 8.0.11

Deadly 提交于 2019-12-24 11:24:18
问题 I run Forward Engineer of sakila_full.mwb on MySQL Workbench 6.3.10. MySQL Server version is 8.0.11. -- ----------------------------------------------------- -- Table `sakila`.`film_text` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sakila`.`film_text` ( `film_id` SMALLINT UNSIGNED NOT NULL, `title` VARCHAR(255) NOT NULL, `description` TEXT NULL, PRIMARY KEY (`film_id`), FULLTEXT INDEX `idx_title_description` (`title` ASC, `description` ASC)) ENGINE =

Using And operator with subquery

白昼怎懂夜的黑 提交于 2019-12-24 10:58:06
问题 Find the sid who have reserved a red and a green boat. Table reserves sid bid 22 101 22 102 22 103 31 103 32 104 Table Boats Bid Color 101 blue 102 red 103 green 104 red Is it possible to use and operator with sub query something like this select sid from reserves where bid in (select bid from boats where color='red') and (select bid from boats where color='green') ; Here I need check whether "bid" is present in the results of both 1st and 2nd sub query then select the sid.It doesn't

Express/MySQL not returning same value returned by MySQL Workbench

寵の児 提交于 2019-12-24 10:50:49
问题 I have a query that is perfectly working when I run it on MySQL Workbench, but when I run it on Express it is returning me all the data on my database. Please help fix? PS. posted this before but didn't get fixed. --Client $.ajax({ url: '/filter', type: 'get', contentType: 'application', data: { categoryIDs : checkedCategory, materialIDs : checkedMaterial, designIDs : checkedDesign}, success: function(response) { console.log(response.products); } }); --Server code getFilteredTable: function

deleting duplicates in sql and modifying relationship table accordingly

烈酒焚心 提交于 2019-12-24 10:49:06
问题 I have three tables: menu_tab has columns (menu_id,menu_description) item_tab has columns (item_id,item_name,item_description,item_price) menu_has_item has columns{ (menu_tab_menu_id ---> which is foreign key to menu_id (pk in menu_tab)), item_tab_item_id --- which is foreign key to item_id (pk in item_tab))4 there will be 2 kinds of duplicates which will be encountered 1)Item duplicate in the same menu_description 2)Item duplicate in a different menu description Example: Two Chicken