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 SQL to manage the data.

-1
votes
1answer
9 views

Mysql fetch rows with value adding upto amount

I have a products table with productName and productPrice. Now i would like to list out all the products that add upto given price, lets say $15. Anyone know how to achieve this? thanks example- ...
0
votes
1answer
16 views

How to delete old duplicate rows based on 2 columns but keep the latest row?

So I have this table (called test_table) id | hotel_id | user_id 1 | 1 | 1 2 | 1 | 1 3 | 1 | 2 4 | 2 | 3 5 | 1 | 2 6 | 3 | ...
0
votes
4answers
15 views

MYSQL Update Table set column equal to select column from same table

I have a new column in my database and I need fill it up with the value of the same column from one specific row. I want to create a feature "copy to all" For example add the same price to all the ...
-1
votes
0answers
11 views

Multiple Undefined Index Errors in PHP [duplicate]

I am trying to create a registration form that registers a new user to MySQL Database. The code is supposed to register the following data: Username Email Password Check password First & Last ...
0
votes
0answers
15 views

Console.log shows “500 (INTERNAL SERVER ERROR)” when sending a POST request via AJAX

I'm trying to create a simple search box using Flask, when I put "m" in the box, it should get a response from AJAX API showing only people names starting with "m" without the page refresh. I stored 5 ...
-1
votes
0answers
23 views

How to fix a problem in the size of a slide show (css,html,php)

The problem we face in slideshow is that the size comes full screen and covers Header, and I want to re-change the size to fit the green box shown in the image. https://www.traidnt.net/vb/images/...
0
votes
0answers
22 views

How to run a SQL script at every MySQL initialization?

I would like to like to run a SQL script at MySQL initialization. This script has basically some UPDATE commands and has be run at each initialization. Basically, the ideia is to update Root and User ...
0
votes
0answers
14 views

Best solution for filling null places in matrix based on other values

can anyone recommend best solution that would fill null places in matrix, based on other values in this matrix? Let's say: 1 NULL 7 NULL 1 NULL 4 NULL 7 So my effect would be something ...
-1
votes
0answers
33 views

Which query is faster in MySQL?

Is it faster to query a single indexed MySQL column string like: SELECT name FROM table WHERE name_city_state = 'john-doe-dallas-tx' or to split up the string into multiple indexed columns like: ...
-1
votes
0answers
19 views

How to speed up MySQL UPDATE queries to get better performances per second

To get better performances on my website, I have to change all INSERT queries to store them first on a CSV file and then automatically import them to a specific table using LOAD DATA INFILE. But what ...
-1
votes
1answer
15 views

Unknown (MEDIUMINT?) issue with Foreign Keys in Laravel 5.8 Migration [duplicate]

I am having trouble adding a MEDIUMINT foreign key constraint to a table. I know it works, in the BASE TABLE the organization_id also references a MEDIUMINT. The first foreign key in the FOREIGN TABLE ...
-1
votes
0answers
12 views

i need to insert array and an integer to my users_skills table

i have users_skills and there are Id as primary key , U_Id which is foreign key to user table on Id , S_Id foreign key to skill table on Id i need to insert to that table an array of skills and the ...
0
votes
0answers
13 views

How to upload images to database in ionic 4 MYSQL & PHP?

I hope you can help me I want to insert the name of the image in my database as well as upload the file to my server but I have no idea how to do it In found a tutorial of ionic 3 but it does not ...
0
votes
0answers
9 views

java.lang.NoClassDefFoundError: org/hibernate/metamodel/source/annotations/JPADotNames Error

I am a complete newbie in springboot and hibernate and jpa. I posted a question earlier but somehow or the other solved that but now I am stuck at another huge error. I was trying to have two ...
-1
votes
1answer
27 views

Add an image to the database for users

How can I add a user avatar to the database? I have authorization and registration of a user on the site via php and ajax! There is a database where there is an "img" column with the varchar type! I ...
2
votes
1answer
24 views

Aggregate query with distinct subquery kills every connection

This query ( from any client, cli, workbench, dbeaver, php library ) completely kills every single connection on the server in mysql 8.0.16, runs as expected on 8.0.15. SELECT SUM( `x` ) FROM ( ...
-1
votes
0answers
13 views

data does not show in database AND date and radio forms don't work

All POST variables are text form types except birthday and gender which are date and radio forms respectively. My text does not go to my database and my radio and date forms don't work. I've tried ...
0
votes
0answers
10 views

How to delete LSEP character (U+2028) from database table?

How to delete LSEP character (U+2028) from database table in MySQL? Text field is contains LSEP symbol, how to delete it?
1
vote
4answers
27 views

Can i use if condition on laravel database query?

Can i use if condition inside query, I want to use filter when $request->review = 7 it will show 7 days data and else condition default 30 days data . $reviews = Review::orderBy('created_at', '...
1
vote
1answer
16 views

MySQL duplicate column on select from select

I have a few tables: resources (which contains all the posts) pid | usrnm | title | link | content | stitle | sdesc | at | likes tags (which contains all the tags and an ID) id | slug retags (which ...
0
votes
1answer
26 views

Php artisan migrate command throws the error

I'm new in the Laravel and I'm facing with a problem. When I run 'php migrate artisan' command it throws the following error: I looked at almost all references, my .env and database.php files seem to ...
0
votes
1answer
22 views

how to update a special sub rows in php mysql

i know how to update a database rows using pdo. For instance to update the row meta_key where userid is 15. I can just do $meta_data='mycontent'; $user_id b='15'; $update1 = $db->prepare(' ...
0
votes
0answers
21 views

How to add a row number column to mysql using php? [duplicate]

I want to add a row number count column my query works in phpmyadmin console but it doesn't work when i try to run it with php using "mysqli_query()". Front end error: Warning: mysqli_num_rows() ...
-1
votes
0answers
11 views

When working on Export Excel data to some data I have numbers [duplicate]

i have many table and i want to Export data from table (A) but some data in table (A) is ID for another Table because i will many to one relationship table with table (A) so .. let me show what data ...
0
votes
2answers
22 views

SQL - Inserting a character into a string Based on Conditions

I have column data. For example, EELMEX00001. I need to insert another zero after the letters. There by making the length 12. Can anyone help me with a query to do this. If the string is less than 11, ...
-1
votes
0answers
17 views

How to add data from database to a table which had been styled previously?

I am trying to make a database where a user enters their information about their name, weight, age, etc. When the user clicks the "Create" button, I want the page to NOT redirect, and then just show ...
1
vote
1answer
16 views

How do I combine multiple rows with matching ID's into separate columns in SQL?

I'm not too experienced with SQL, so not sure if a similar question has already been answered (I'm sure there is, but I'm way out of my depth here). I used to be great at SQL many years back, but it's ...
-2
votes
0answers
19 views

How to deal with multiple sessions modifying a database in php? [duplicate]

I am writing a simple forum in PHP and I am faced with the following problem. When I register a new user I query the database if the user already exists. If the user doesnt exist I insert a new record ...
0
votes
2answers
22 views

Laravel eloquent query having JOIN and subquery

I have to use a query in Laravel eloquent (query builder) but I'm not sure how to convert it: SELECT c.*, m.*,th.team as team_home, ta.team as team_away from schedule as c LEFT JOIN matches as m ON ...
0
votes
3answers
31 views

Multi relation foreign keys

If I have 3 tables: User, Conversation, Messages Between User and conversation I have: $table->foreign('user_id') ->references('id') ->on('users') ...
0
votes
0answers
13 views

Unable to setup mysql in google cloud shell

I'm trying to install mysql in a cloud engine through the cloud shell I installed it with: sudo apt-get -y install mysql-server And set password with: sudo mysql_secure_installation when I input ...
0
votes
1answer
21 views

How to query records where one field greater than another by x days?

I have a table like: +----+------------+------------+ | id | expiry | timestamp | +----+------------+------------+ | 1 | 2018-11-29 | 2018-11-01 | | 2 | 2018-12-27 | 2018-11-01 | | 3 | 2019-...
0
votes
1answer
32 views

org.json.JSONException: Value DB of type java.lang.String cannot be converted to JSONObject

I'm making an Android login feature. Originally, it was made using localhost, but it is re-created with free hosting because it wants to have an external connection. I uploaded php over FTP and ...
-5
votes
0answers
27 views

Is there anybody to help me in this code please? [on hold]

I am trying to make an Online store website but stuck at some point and for last couple of months trying and just trying but unable to solve the issue, it would really be appreciated if someone help ...
0
votes
2answers
25 views

Join newest price from price-table for all products

I've a product and a price table (with product id, price and timestamp columns). Now I need to join to a simple select of products the newest price. The simple join will select the first saved price ...
0
votes
0answers
12 views

Rails query for 'comma separated string' in array

This is for a rails site for articles. Articles have tags stored in 4 different fields - technology_tag, sub_segment_tag and couple more fields. Each of these fields stores a comma separated string. ...
0
votes
2answers
33 views

Left join two tables and if value exists in both tables, keep the latest value from right table

I am trying to left join two tables. This part is simple. I have two tables: product and productupdate product table looks like this id | productname | description productupdate table looks like ...
0
votes
1answer
15 views

InnoDB clustered index performance when using random values as primary key

By default, my primary keys of InnoDB storage engines are auto increment integers. In effort, to hide the number of rows in the database, application code implements some random generator for the ...
0
votes
0answers
22 views

How to store irregular table?

I am creating a table on front with javascript. User can add columns and rows, so tables may be irregular, for example 10 rows and 5 columns or 3 rows and 7 columns. I don't have an idea how to store ...
0
votes
1answer
16 views

How to get a current years' monthly sum of amount and display it in consoleTv bar chart

I have tried with few queries. But it doesn't work form me. $amount = DB::select('select month(created_at) as month, sum(amount) as total_amount from orders group by month(created_at)'); I am ...
-3
votes
0answers
12 views

Can\'t create table `mysql`.`user` (errno: 168 "Unknown (generic) error from engine

Can't create table mysql.user (errno: 168 "Unknown (generic) error from engine"
2
votes
2answers
17 views

How to use single posted parameter to run either BETWEEN or IN(SELECT parameter FROM table) type query?

I have a bootstrap 4 form posting data to a PHP page. One of the variables is $_POST['age']; I want to use this variable in a manner that when $_POST['age'] equals NULL, $age = 'IN("SELECT age FROM ...
0
votes
0answers
10 views

Connection to wamp local server with DataGrip

I'm trying to connect to my local MySQL server (wamp), but when I put all the information in datagrip it cannot create a connection. The database tts exists as is shown below:
0
votes
0answers
17 views

How to display data int textbox from mysql database and update again after few changes?

I have a table for students, i have been successful in retrieving data and displaying them into text-box after i clicked the search button, then i changed a few words into some text-box and clicked ...
0
votes
0answers
22 views

Nothing fetching content with server

Hosting company updated servers or added new patchs can't get a straight answer. I updated code looked online and stuck. Tried to have hosting check with server and company keeps coming back and ...
0
votes
0answers
15 views

Reporting app design -> read, write and create report

I need to design a webapp that will be able to write, read and write back (update/insert) to a database and create REPORT (pdf, jpg,..etc). Data size would go upto 100GB and all are numerical and text ...
0
votes
1answer
32 views

How can I get a host name to connect from outside instead of 'localhost'

I'm setting up a Database that will go into my android studio project, the host name i'm getting now is localhost. I'm not sure if it's the reason why the data I input from the app simulator isn't ...
0
votes
0answers
14 views

Laravel - Query for Aging Report using Laravel

I have MySQL query that I want to convert to Laravel. SELECT client_id, DATEDIFF(CURDATE(), due_date) AS days_past_due, SUM(IF(days_past_due = 0, amount_due, 0)), SUM(IF(days_past_due BETWEEN 1 AND ...
-1
votes
0answers
39 views

Find a full path in the corresponding columns

I have a table with the two columns. The first one contains course id idx and the second column contains the id of the course that follows p_idx. The table looks like this: I need to get a path ...
0
votes
4answers
33 views

How do i use and with multiple or condition?

my target where qq blank AND match ab with OR condition. SELECT xyz FROM admin WHERE qq = '' AND ab LIKE 'some1' OR ab LIKE 'some2' OR ab LIKE 'some3'