LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

422 solutions found in database

Page 21 of 22
0 votes
1 ans
26 views
How to reset AUTO_INCREMENT in MySQL

How can I ***reset*** the `AUTO_INCREMENT` of a field? I want it to start counting from `1` again.

database Solved
HO
asked 5 months ago by homerun
0 votes
1 ans
26 views
Can I concatenate multiple MySQL rows into one field?

Using `MySQL`, I can do something like: SELECT hobbies FROM peoples_hobbies WHERE person_id = 5; **My Output:** shopping fishing codi...

database Solved
DE
asked 5 months ago by Dean Rather
0 votes
1 ans
28 views
How can I output MySQL query results in CSV format?

Is there an easy way to run a MySQL query from the Linux command line and output the results in [CSV][1] format? Here's what I'm doing now: ```lan...

database Solved
MC
asked 5 months ago by MCS
0 votes
1 ans
29 views
How can I get a list of user accounts using the command line in MySQL?

I'm using the MySQL command-line utility and can navigate through a database. Now I need to see a list of user accounts. How can I do this? I'm using...

database Solved
BU
asked 5 months ago by burntsugar
0 votes
1 ans
28 views
Which MySQL data type to use for storing boolean values

Since MySQL doesn't seem to have any 'boolean' data type, which data type do you 'abuse' for storing true/false information in MySQL? Esp...

database Solved
BE
asked 5 months ago by Beat
0 votes
1 ans
29 views
Retrieving the last record in each group - MySQL

There is a table `messages` that contains data as shown below: Id Name Other_Columns ------------------------- 1 A A_data_1 2...

database Solved
VI
asked 5 months ago by Vijay Dev
0 votes
2 ans
21 views
MySQL error code: 1175 during UPDATE in MySQL Workbench

I want to update the column `visited` to give it the value 1. I tried this command in the SQL editor inside MySQL workbench: UPDATE tablename SET columnn...

database Solved
JU
asked 5 months ago by Jury A
0 votes
1 ans
29 views
How can I get the sizes of the tables of a MySQL database?

I can run this query to get the sizes of all tables in a MySQL database: show table status from myDatabaseName; I would like some help in understandin...

database Solved
JP
asked 5 months ago by JPashs
0 votes
1 ans
32 views
Insert into a MySQL table or update if exists

I want to add a row to a database table, but if a row exists with the same unique key I want to update the row. For example: ```sql INSERT INTO table_nam...

database Solved
KE
asked 5 months ago by Keshan
0 votes
1 ans
30 views
How do I rename a MySQL database (change schema name)?

How do I quickly rename a MySQL database (change its schema name)? Usually I just dump a database and re-import it with a new name. This is not an option for...

database Solved
DE
asked 5 months ago by deadprogrammer
0 votes
2 ans
27 views
Join vs. sub-query

I am an old-school MySQL user and have always preferred `JOIN` over sub-query. But nowadays everyone uses sub-query, and I hate it; I don't know why....

database Solved
YO
asked 5 months ago by Your Common Sense
0 votes
2 ans
33 views
How can I do 'insert if not exists' in MySQL?

I started by googling and found the article *[How to write INSERT if NOT EXISTS queries in standard SQL][1]* which talks about mutex tables. I have a table w...

database Solved
WA
asked 5 months ago by warren
0 votes
1 ans
30 views
How can I find all the tables in MySQL with specific column names in them?

I have 2-3 different column names that I want to look up in the entire database and list out all tables which have those columns. Is there any easy script?

database Solved
JO
asked 5 months ago by Jobi Joy
0 votes
1 ans
29 views
How do I specify unique constraint for multiple columns in MySQL?

I have a table: table votes ( id, user, email, address, primary key(id), ); How can I make the columns **user, e...

database Solved
NI
asked 5 months ago by Niyaz
0 votes
1 ans
27 views
How do you set a default value for a MySQL Datetime column?

How do you set a default value for a MySQL Datetime column? In SQL Server it's `getdate()`. What is the equivalant for MySQL? I'm using MySQL 5.x if...

database Solved
BR
asked 5 months ago by Brian Boatright
0 votes
1 ans
26 views
mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc... expects parameter 1 to be resource

I am trying to select data from a MySQL table, but I get one of the following error messages: > mysql_fetch_array() expects parameter 1 to be resource, bo...

database Solved
IA
asked 5 months ago by iamjonesy
0 votes
1 ans
28 views
Finding duplicate values in MySQL

I have a table with a varchar column, and I would like to find all the records that have duplicate values in this column. What is the best query I can use to fi...

database Solved
JO
asked 5 months ago by Jon Tackabury
0 votes
1 ans
27 views
MySQL: Large VARCHAR vs. TEXT?

I've got a messages table in MySQL which records messages between users. Apart from the typical ids and message types (all integer types) I need to save the...

database Solved
TO
asked 5 months ago by Tom
0 votes
1 ans
31 views
How can I SELECT rows with MAX(Column value), PARTITION by another column in MYSQL?

I have a table of player performance: ``` CREATE TABLE TopTen ( id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, home INT UNSIGNED NOT NULL, `datetime`D...

database Solved
KA
asked 5 months ago by Kaptah
0 votes
1 ans
28 views
How can I enable the MySQLi extension in PHP 7?

I have installed PHP 7 and MySQL 5.5.47 on Ubuntu 14.04 (Trusty Tahr). I have checked installed extension using: sudo apt-cache search php7-*...

database Solved
AL
asked 5 months ago by Al-Rashid AI