LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

422 solutions found in database

Page 7 of 22
0 votes
1 ans
3 views
How to use MySQL DECIMAL?

I can't quite get a grasp of MySQL's DECIMAL. I need the row to be able to contain a number anywhere from 00.0001 to 99.9999. How would I structure it t...

database Solved
CH
asked 1 month ago by Charles Zink
0 votes
1 ans
3 views
How to properly create composite primary keys - MYSQL

Here is a gross oversimplification of an intense setup I am working with. `table_1` and `table_2` both have auto-increment surrogate primary keys as the ID. `in...

database Solved
FI
asked 1 month ago by filip
0 votes
1 ans
3 views
Detect if value is number in MySQL

Is there a way to detect if a value is a number in a MySQL query? Such as SELECT * FROM myTable WHERE isANumber(col1) = true

database Solved
UR
asked 1 month ago by Urbycoz
0 votes
1 ans
3 views
Return 0 if field is null in MySQL

In MySQL, is there a way to set the "total" fields to zero if they are NULL? Here is what I have: SELECT uo.order_id, uo.order_total, uo.ord...

database Solved
KE
asked 1 month ago by Kevin
0 votes
1 ans
3 views
How to post query parameters with Axios?

I am trying to post on an API with some query params. This is working on PostMan / Insomnia when I am trying to by passing mail and firstname as query paramete...

database Solved
GU
asked 1 month ago by GuillaumeRZ
0 votes
1 ans
3 views
Reset MySQL root password using ALTER USER statement after install on Mac

I recently installed MySQL and it seems I have to reset the password after install. It won't let me do anything else. Now I already reset the password th...

database Solved
DE
asked 1 month ago by dengar81
0 votes
1 ans
3 views
Datetime equal or greater than today in MySQL

What's the best way to do following: SELECT * FROM users WHERE created >= today; Note: created is a datetime field.

database Solved
N0
asked 1 month ago by n00b
0 votes
1 ans
3 views
MySQL select where column is not empty

In MySQL, can I select columns only where something exists? For example, I have the following query: select phone, phone2 from jewishyellow.user...

database Solved
MI
asked 1 month ago by mike
0 votes
1 ans
3 views
Using column alias in WHERE clause of MySQL query produces an error

The query I'm running is as follows, however I'm getting this error: > \#1054 - Unknown column 'guaranteed_postcode' in 'IN/ALL/ANY subq...

database Solved
JA
asked 1 month ago by James
0 votes
1 ans
3 views
Is the primary key automatically indexed in MySQL?

Do you need to explicitly create an index, or is it implicit when defining the primary key? Is the answer the same for MyISAM and InnoDB?

database Solved
AL
asked 1 month ago by Alex Miller
0 votes
1 ans
3 views
Cannot delete or update a parent row: a foreign key constraint fails

When doing: DELETE FROM `jobs` WHERE `job_id` =1 LIMIT 1 It errors: #1451 - Cannot delete or update a parent row: a foreign key constraint fai...

database Solved
ST
asked 1 month ago by steven
0 votes
1 ans
3 views
MySql: Tinyint (2) vs tinyint(1) - what is the difference?

I knew boolean in mysql as `tinyint (1)`. Today I see a table with defined an integer like `tinyint(2)`, and also others like `int(4)`, `int(6)` ... What...

database Solved
RE
asked 1 month ago by realtebo
0 votes
1 ans
3 views
MySQL Cannot drop index needed in a foreign key constraint

I need to ALTER my existing database to add a column. Consequently I also want to update the UNIQUE field to encompass that new column. I'm trying to remove...

database Solved
US
asked 1 month ago by user391986
0 votes
1 ans
3 views
MySQL DISTINCT on a GROUP_CONCAT()

I am doing `SELECT GROUP_CONCAT(categories SEPARATOR ' ') FROM table`. Sample data below: categories ---------- test1 test2 test3...

database Solved
US
asked 1 month ago by user371990
0 votes
1 ans
3 views
Simple way to calculate median with MySQL

What's the simplest (and hopefully not too slow) way to calculate the median with MySQL? I've used `AVG(x)` for finding the mean, but I'm having a h...

database Solved
DA
asked 1 month ago by davr
0 votes
1 ans
3 views
Foreign key constraints: When to use ON UPDATE and ON DELETE

I'm designing my database schema using MySQL Workbench, which is pretty cool because you can do diagrams and it converts them :P Anyways, I've decide...

database Solved
ME
asked 1 month ago by meltuhamy
0 votes
1 ans
3 views
MySQL Incorrect datetime value: '0000-00-00 00:00:00'

I've recently taken over an old project that was created 10 years ago. It uses MySQL 5.1. Among other things, I need to change the default character...

database Solved
LO
asked 1 month ago by lorm
0 votes
1 ans
3 views
mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists

While starting mysql server 5.7.17 using mysqld_safe, following error occcours. 2017-02-10T17:05:44.870970Z mysqld_safe Logging to '/var/log/mysql/er...

database Solved
RA
asked 1 month ago by Rajadip
0 votes
1 ans
3 views
Create a new database with MySQL Workbench

Being new to MySQL, I have installed the latest version of the MySQL Workbench (5.2.33). I would like to know how you can create a database with this applicatio...

database Solved
AN
asked 1 month ago by Ant
0 votes
1 ans
3 views
MySQL: Cloning a MySQL database on the same MySql instance

I would like to write a script which copies my current database `sitedb1` to `sitedb2` on the same mysql database instance. I know I can dump the sitedb1 to a s...

database Solved
UC
asked 1 month ago by uclajatt