Search results
1 cze 2021 · Use this trick for numbers: SELECT '' || 4 || 2; -- result: 42. Some databases implement non-standard solutions for concatenating strings like CONCAT() or CONCAT_WS(). Check the documentation for your specific database. LIKE OPERATOR – PATTERN MATCHING. Use the _ character to replace any single character.
SELECT. CustomerID , TotalOrderAmount. , CASE WHEN ((TotalOrderAmount > 0) AND (TotalOrderAmount <= 1000)) THEN ’low’ WHEN ((TotalOrderAmount > 1000) AND (TotalOrderAmount <= 5000)) THEN ’medium’ WHEN ((TotalOrderAmount > 5000) AND (TotalOrderAmount < 10000)) THEN ’high’ ELSE ’very high’ END AS CustomerGroup. FROM.
* Powerful, database-specific features such as SQL Server's PIVOT and UNPIVOT operators, Oracle's MODEL clause, and PostgreSQL's very useful GENERATE_SERIES function * Pivoting rows into columns, reverse-pivoting columns into rows, using pivoting to facilitate inter-row calculations, and double-pivoting a result set
Query and modify data effectively with the latest T-SQL features Master Transact-SQL's fundamentals, and write correct, robust code for querying and modifying data with modern Microsoft data technologies, including SQL Server 2022, Azure SQL Database, and Azure SQL Managed Instance.
1 cze 2021 · Fetch all names that start with any letter followed by 'atherine': SELECT name FROM names WHERE name LIKE '_atherine'; Fetch all names that end with 'a': SELECT name FROM names WHERE name LIKE '%a'; USEFUL FUNCTIONS. Get the count of characters in a string: SELECT LENGTH('LearnSQL.com');-- result: 12 Convert all letters to lowercase: SELECT ...
22 paź 2024 · These exercises are designed to provide hands-on experience with common SQL tasks, from basic retrieval and filtering to more advanced concepts like joins window functions, and stored procedures.
Solutions to Exercise 4-4: Using Date and Time Functions 155