I need to change a table field in my database to perform some tests, and would like to update only the last 100 records in the table. I already tried this code: UPDATE titulo SET autorizado='S' ORDER BY id_titulo DESC LIMIT 100; More this...
In Oracle, when we want to know how much a table occupies disk we can query the dba_segments dictionary.
SELECT segment_name, segment_type, bytes/1024/1024 MB
FROM dba_segments
WHERE segment_type='TABLE' and segment_name='<nome-tabel...
I have a field called titulo , in the noticias table. Unfortunately, due to forgetting PHP's trim command, it has several titles with space at the beginning and end of the string . How can I via SQL (MySQL) update the titles...
In MySQL to set the charset of a table we can use this way:
MySQL:
create table user_details (...) default character set = utf8;
How can I do the same in SQL Server?
I have a database in which I need to search based on the keywords, regardless of the order. See the full table below:
+----+-----------------------+
| id | description |
+----+-----------------------+
| 1 | joão de santo cristo |
|...
I have the following tables:
permissoes_users
id_user
id_permission
permissions
id
- Permission
I have a session variable where I have the id di user, I need to search the table for the id and those that have the id of the user to...
I need to create a query with the insertion of several lines.
Change an array / list:
arrayOriginal = [10,20,30,40]
valueChave = 999
The return must be:
arrayNew = [(valueChave, 10), (valueChave, 20), (valueChave, 30)...
I made this code to create databases :
public function addDatabase($name, $collation) {
try {
$sql = "CREATE DATABASE ':name' COLLATE ':collation';";
// Prepare the query to execute
$query = $th...
Normally, when working with a insert on tableA if it is based on select of a tableB, we do something similar to this:
INSERT INTO tabelaA ( column1, column2, someInt, someVarChar )
SELECT tabelaB.column1, tabelaB.column2, 8, 'so...
I have the following tables:
What I'm trying to do is fetch the names of users who have no records in tbl_votos and no resources in tbl_recursos in the last 5 days . I'm using php and mysql.