By using CONCAT function in mysql, we can concat fields or string. SELECT CONCAT(‘field1’, ‘-‘, ‘field2’, ‘-‘, ‘field3’); // Output: // ‘field1-field2-field3’
Sql
Posted inAll / Sql
get number of days between two given dates using MySQL
SELECT DATEDIFF(“2007-03-07”, “2007-03-01”); // For static dates SELECT DATEDIFF(ColumnA, ColumnB); // For Table column based dates
Posted inAll / Sql
get number of records count in mysql
To get the records count of table in mysql: SELECT COUNT(‘fieldname’) AS RecordsCount FROM TableName; (OR) SELECT COUNT(*) FROM TableName;
Posted inAll / Sql
Maximum length of a Database name, Table name, Field name in MySQL
Database name: 64 characters Table name: 64 characters Column name: 64 characters