DATE_FORMAT(date,format) The following script uses the DATE_FORMAT() function to display different formats. We will use the NOW() function to get the current date/time: DATE_FORMAT(NOW(),’%b %d %Y %h:%i %p’) DATE_FORMAT(NOW(),’%m-%d-%Y’) DATE_FORMAT(NOW(),’%d %b %y’) DATE_FORMAT(NOW(),’%d %b %Y %T:%f’) The result would look something like this: Nov 04 2014 11:45 PM 11-04-2014 04 Nov 14 04 Nov 2014 11:45:34:243
Categoria: SQL
Mysql Proper Case
Detect invalid(sintax) emails
Detect invalid(sintax) emails in db
Query to list number of records in each table in a database
sql server 2005
Schedule Mysql Backups to Amazon S3 in Windows server 2008 R2
1 – Access Amazon Services, S3 2 – Create a New Bucket if there’s no one. 3 – Create credentials in IAM Amazon Services 4 – Download the tool s3.exe for windows, from s3.codeplex.com
SQL Server, Common Table Expressions
A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query. A CTE can be used to: Create a recursive query. For more information, see Recursive Queries Using Common Table Expressions. Substitute for a …
Recursive Queries using Common Table Expressions (CTE) in SQL Server
Given the example , hierarchical data structures, organizational charts and other parent-child table relationship reports can easily benefit from the use of recursive CTEs. Common Table Expression is just one of those T-SQL enhancements available for SQL Server 2005. CTEs bring us the chance to create much more complex queries while retaining a much simpler syntax. They also can lessen the administrative burden of creating and testing views for situations where the view will not be reused. Syntax Sample (from Root nodes to Leaf noes) Sample (From Leaf nodes to Root nodes), where u must specifie the leaves to include/use. !Importante …
mysql ‘Proper case’ formating a column?
How to do something like: Proper(“GALHANO.COM”) = “Galhano.com” there’s no builtin function to do this but we combine CONCAT and SUBSTRING:
Finding Duplicates with SQL
Here’s query for finding duplicates in a table. Suppose you want to find all Usernames values in a table that exist more than once: