Questions tagged [mysql]

MySQL is a free, open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). DO NOT USE this tag for other DBs such as SQL Server, SQLite etc. Those are different DBs which all use their own dialects of SQL to manage the data.

Filter by
Sorted by
Tagged with
0
votes
1answer
20 views

How to add a tag based on a column value

I'm trying to join two tables and select certain columns to display in the output including a 'flag' if a certain transaction amount is greater than or equal to 100. The flag would return a 1 if it is,...
0
votes
0answers
10 views

DELETING MULTIPLE ROW CHECKBOX DATA IN MYSQL USING NODEJS

i want to make multiple delete or checkall data using mysql and NodeJS but not working. this is my code. <form id="add-row-form" action="/api/delete_masterdata" method="post"> <div ...
0
votes
0answers
11 views

Need some help developing a login application with Hibernate framework, MySQL database and MVC structure

This is my js code. I am passing data through ajax to LoginServlet. $.ajax({ type: 'GET', url:'LoginServlet', data: { username:...
-1
votes
0answers
11 views

“Group by” troubles with subquerys

I'm trying to do agrupations to show stats, to show income vs expenses by month (the table have date and amount fields). I do this many times in Oracle, with this query: select X.ANIO, X.MES, (select ...
0
votes
0answers
17 views

Datatables(): ordering + pagination with Ajax + Mysql

I am struggling with Datatables() using AJAX to pull data from a MySQL table running my PHP script. I understand that Datatables() comes with several features including sorting, pagination, etc, all ...
0
votes
2answers
21 views

How to select percentage values per group in mysql

I am trying to select percentage values for each group in mySql. I tried to do it in memory, but it is a lot of code to maintain. It would be graceful if I do it via SQL. I am selecting the ...
0
votes
0answers
10 views

How do you revoke all EXECUTE privileges for a user in MySQL?

I need to grant EXECUTE PROCEDURE privileges to a user for specific procedures, only for a period of time. After the time period, I want to remove all execute privileges from the user - but leave ...
0
votes
0answers
14 views

Build data from subsequent rows

I'm not exactly sure what terminology to use to ask the question, so part of this is helping me to understand the terminology to use, but another part is identifying the solution. My apologies in ...
0
votes
0answers
16 views

Scala Extract the column from struct

I want to make a query df.select() and extract the created_at field from the struct below in Scala. I have tried various different techniques such as explode and flattening but that is not what I want....
0
votes
0answers
14 views

query to list product lines of products whose quantity in stock is the least

SELECT ProductLines.productLine, COUNT(quantityInStock) FROM ProductLines JOIN Products USING (productLine) GROUP BY customerName HAVING COUNT(quantityInStock) = (SELECT MIN(...
0
votes
0answers
9 views

ERROR: Error 1822: Failed to add the foreign key constraint

ERROR: Error 1822: Failed to add the foreign key constraint. Missing index for constraint 'StudentID' in the referenced table 'student' My Create Table SQL Code: -- ------------------------------...
0
votes
2answers
21 views

MySQL function (macro?) available to all databases?

I often find myself doing select group_concat(COLUMN_NAME separator ', ') FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='<current database>' AND TABLE_NAME='<argument>';. I manually ...
0
votes
1answer
10 views

I can't insert entity into DB with CRUD operations

I'm trying to insert entity in DB but .save(), .edit(), etc... not working. it doesn't show any error. Also, this works if i insert it with CommandLineRunner but this way not. Am I forgetting ...
0
votes
0answers
9 views

How to upgrade mysql_pconnect to mysqli [duplicate]

I am trying to set up a website that uses outdated php constructs. I am trying to set up ShoutIRC bot to run a web request web page. They use outdated php codes because it is an old script. I have ...
-1
votes
0answers
18 views

how to count row from single column by specific digit stored in mysql in php?

I want to count total number of rows in a specific column by specific digit from mysql database. Suppose I have "RatingTable" and My database structure is: id username rating Now suppose I have ...
0
votes
2answers
16 views

Equivalent of GREATEST() in HQL

I'm trying to find the greatest of two dates in HQL. In SQL this works: SELECT ( GREATEST(a1.startDate, '2019-10-01T00:00:00Z') ) FROM Activity AS a1 WHERE a1.id = 66232 But the equivalent in HQL ...
0
votes
3answers
35 views

Is there a way to return multiple unrelated results in an sql query?

I'm trying to create a "feed" system on my site where activity on users' posts is posted. To do this effectively and order all activity by date, I need to put everything in one huge query (unless ...
1
vote
2answers
21 views

Setting rank based on query

I've a table items listing different elements with id, popularity and rank columns. popularity column contains an int allowing to sort elements by popularity. I've made a query to sort by popularity ...
0
votes
1answer
25 views

How to handle async call to mysql database

I'm pretty new to nodejs which is probably why I'm asking this question. I recently discovered that calls being made with nodejs to any database are async. As a former C# .Net programmer this is ...
0
votes
1answer
35 views

Java + MySQL: Do i have a good way to encrypt a password?

I want to hear your opinion on my following thought of encrypting passwords for my usage. I have a JFrame program which uses a textfield (username) and a passwordfield to "login". I want the password ...
0
votes
1answer
21 views

Can't connect to mysql in kubernetes

I have deployed a mysql database in kubernetes and exposed in via a service. When my application tries to connect to that database it keeps being refused. I also get the same when I try to access it ...
-1
votes
1answer
21 views

Finding count of occurrences from a table of unique values

I have a movie database with three tables. Filmparticipation, Person and Filmcharacter My problem is that I have to find every actor that has acted as a unique character in over 200 movies. An ...
0
votes
0answers
27 views

Which of these MySQL approaches is faster?

Let's say there's a table in MySQL that's called MyTable Is it faster to do something like: MyTable contains ID (primary), someField, foreignId, (a reference to a key in another table), randomField, ...
0
votes
0answers
8 views

How do you access the value of a stored procedure out parameter when using the AWS RDS Data Service API?

When using the AWS RDS Data API to execute a stored procedure in a MySQL database, how do you get the value of out parameters set by the stored procedure? In the below example I'm looking for how to ...
0
votes
2answers
17 views

Docker php DPO to MariaDB - Error: Could not find driver

I'm learning PDO now and I found it better to learn it in a LEMP docker stack (Nginx, php-fpm, MariaDB, phpMyadmin) on my Ubuntu 18.04LTS. This is my php file: <?php try { $mydb = new PDO('...
0
votes
0answers
28 views

MySQL Server 8.0.18 has failed Windows 10

I am new to MySQL Server. I am trying to install MySQL Server 8.0.18 on Windows 10 laptop. I am new to MySQL, so I have not tried anything other than to install. This is the log file: Beginning ...
0
votes
0answers
7 views

Unit test for LockModeType.PESSIMISTIC_WRITE

If I execute this query hope I will be able to get a row lock @Lock(LockModeType.PESSIMISTIC_WRITE) @Query("SELECT c FROM Customer c WHERE c.orgId = ?1") public List<Customer> ...
0
votes
2answers
20 views

I have a mysql connection problem, although I connect to the command line with the same parameters

static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost:3306/gestionrh"; // Database credentials static final String USER = "...
0
votes
0answers
7 views

how can i fix ping failed error in connection in mySQl

I get into trouble when I want to make a connection if anyone can help... databasename :hibernate4 url : jdbc:mysql://localhost:3306/hibernate4 username : root pass : pass Error ping failed to give:
-1
votes
3answers
21 views

Don't allow duplicate email address to be inserted into the database

This file for entering the mail <?php include("connect.php"); session_start(); $email = $_POST["EMAIL"]; $query = "INSERT INTO `newsletter` ( `EMAIL`) VALUES ( '$email')"; mysqli_query($link,$...
0
votes
1answer
35 views

Is it possible to select from the result of a subquery in a join

So I have a large subquery and I would like to join on that subquery while using the result of the subquery in the join. For example, I have a table called patient and one called appointment, and I ...
0
votes
0answers
7 views

Error code (255) when logging in with phpMyAdmin

Getting mysqli_real_connect(): Server sent charset (255) when trying to log into MySQL with phpMyAdmin. I know this is a duplicate, but solutions offered (create file: my.cnf and adding code to ...
0
votes
0answers
12 views

Is there any way to create triggers and stored procedures in an RDS MySQL instance at create time when creating an Elastic Beanstalk environment?

By default, RDS MySQL instances, created during Elastic Beanstalk environment creation, do not allow the creation of triggers, functions, and stored procedures because the master user does not have ...
1
vote
2answers
26 views

JpaRepository findAll() will not return rows with null fields

I have a JPA Repository like so: @Repository public interface DocumentTagsViewRepository extends JpaRepository<DocumentTagsView, Long>, JpaSpecificationExecutor<DocumentTagsView> { And ...
-1
votes
0answers
33 views

Laravel: How to save data from form to different tables?

I have a form in which the user can enter different data (pages data), the form contains two parts, looks like this. The first part of the form has no relationship it's saved directly to its ...
0
votes
0answers
27 views

SQLSTATE[HY000] [2002] Connection refused SQL

I am using MacBook. I installed Xampp on my system and started it on machine. Now I am able to access my local database through http://localhost:8080/phpmyadmin/db_structure.php?server=1&db=...
0
votes
3answers
42 views

How to show positions of '1' within a long number mysql

I know I can find the first position of 1 with my number by using the following: SELECT POSITION("1" IN "0000100001000001"); How would I find all the positions of 1 to return 5;10;16
0
votes
1answer
12 views

checking for no rows after calling a stored procedure using php pdo to a mysql database columnCount not working

$sql = "CALL pr_cartItemsForCustomer (:customerId)"; $statement = $connection->prepare($sql); $statement->bindValue(':customerId',$customerId); $statement->execute(); ...
0
votes
0answers
12 views

Many-to-many associations using Sequelize using Nodejs

I was trying to create a many-to-many association between Product and Order model I have created 3rd table between Product and Order table is Orderline as image here I have read a guide is create ...
0
votes
1answer
23 views

Homebrew MySQL 8.0.18 on macOS 10.15 Catalina won't run as service

Another macOS upgrade + another MySQL upgrade = another set of problems. I can't seem to get MySQL 8.0.18 to run as a homebrew service on macOS 10.15 Catalina. Please show me the error of my ways. ...
0
votes
0answers
30 views

Unable to connect to any of the specified MySQL hosts when I just start to configure

I was starting to learning SQL, then I download MySQL, but I am stuck in this error, I retry again and again but it didn't work still. Beginning configuration step: Starting the server Attempting to ...
0
votes
2answers
25 views

PHP INSERT is not working for some unknown reason

I'm setting up a simple system that takes the user input in a new_post.php file in a form and sends that information using POST to index.php. index.php then receives that information, and, if it ...
0
votes
1answer
14 views

How to enable events scheduler on phpmyadmin

When I try to enable events scheduler on phpmyadmin (I'm using XAMPP on mac os) I get this error: #1408 - Event Scheduler: An error occurred when initializing system tables. Disabling the Event ...
-3
votes
0answers
27 views

Which is better to use, MySQL function or trigger to Update multiple tables, Or to code in Laravel(PHP)? [on hold]

I'm developing a website where I want to add a Entry to multiple table when particular table is updated(I'm Using MySQL). I'm developing it with Vue.js and api with Laravel. Is it better to use MySql ...
0
votes
1answer
19 views

NodeJs Perform Operation on Each returned MySql Result Object

Im using NodeJs to fetch data from mysql database, from the result object/array i want to perform specific action (call web service) with data returned from mysql. unfortunately whenever i iterate ...
0
votes
1answer
21 views

beautiful soup scrap to MySQL using Python. Stuck on if string contains do else do something else

Just wondering if anyone could help me as im getting defeated - new to python and this has had me trial and error for the last 4 hrs and im getting to the point where im getting lost in my ammendments....
0
votes
0answers
14 views

I have InvalidArgumentException when I make database seeding

I'm work on Restful API , I have exception message when i want to make seeding fake data in database. I make database fresh . php artisan migrate:fresh I seeding on database . php artisan db:...
0
votes
1answer
21 views

How to add oracle TRUNC(SYSDATE-100,'Q') to MySQL

I have MySQL installed and I have an oracle script with me and I create schemas and tables and stuck with trunc and quarter in oracle and want them to insert in MySQL. how to use trunc and q while ...
-1
votes
0answers
12 views

PDO wrapper muliple select

I've got this simple PDO wrapper: class Db { private static $connection; private static $options = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, PDO::...
0
votes
1answer
19 views

Can I JOIN two tables in different databases with only one match with sum values for each row that repeat in tables in MySQL?

I have 2 databases with product table with ID and quantities like this: db1.products ID Stock 1 10 2 20 3 30 db2.products ID Stock 1 3 2 5 4 40 And need join, sum ...