Langsung ke konten utama

Postingan

Difference: SQL UNION vs UNION ALL?

  Difference: SQL UNION vs UNION ALL ? UNION and UNION ALL are both used to retrieve records from multiple tables. This article will detail the differences between the two, allowing you to make the best choice for each unique scenario. You can use SQL’s  UNION  and  UNION ALL  commands to get data from multiple tables in your database. It’s a common use case, considering that most databases have many tables. Both  UNION  and  UNION ALL  are known as set operators. In SQL, set operators combine the results of two or more queries into a single result. You can  read more about set operators in this article . When comparing  UNION  vs.  UNION ALL , there is one major difference: UNION  only returns  unique UNION ALL  returns  all  records, including duplicates. If you feel like you would benefit from a well-structured, comprehensive course that covers foundational SQL, consider this  SQL...
Postingan terbaru

Everything all about REGEX

 https://towardsdatascience.com/everything-you-need-to-know-about-regular-expressions-8f622fe10b03 Everything you need to know about Regular Expressions What is a Regular Expression? On an abstract level a regular expression, regex for short, is a shorthand representation for a set. A set of strings. Say we have a list of all valid zip codes. Instead of keeping that long and unwieldy list around, it’s often more practical to have a short and precise pattern that completely describes that set. Whenever you want to check whether a string is a valid zip code, you can match it against the pattern. You’ll get a true or false result indicating whether the string belongs to the set of zip codes the regex pattern represents. Let’s expand on the set of zip codes. A list of zip codes is finite, consists of rather short strings, and is not particularly challenging computationally. What about the set of strings that end in  .csv ? Can be quite useful when looking for data files. This set ...

How To Get row_number in MySQL

 https://ubiq.co/database-blog/how-to-get-row_number-in-mysql/ SELECT t.*, @rownum := @rownum + 1 AS rank FROM sales t, (SELECT @rownum := 0) r order by amount desc; +------+---------------------+--------+------+ | id | order_date | amount | rank | +------+---------------------+--------+------+ | 1 | 2021-02-02 08:15:00 | 250 | 1 | | 10 | 2021-02-02 11:15:00 | 250 | 2 | | 5 | 2021-02-02 09:30:00 | 250 | 3 | | 9 | 2021-02-02 10:45:00 | 200 | 4 | | 12 | 2021-02-02 11:45:00 | 200 | 5 | | 6 | 2021-02-02 09:45:00 | 200 | 6 | | 2 | 2021-02-02 08:30:00 | 200 | 7 | | 7 | 2021-02-02 10:15:00 | 180 | 8 | | 3 | 2021-02-02 08:55:00 | 150 | 9 | | 11 | 2021-02-02 11:30:00 | 150 | 10 | | 4 | 2021-02-02 09:15:00 | 125 | 11 | | 8 | 2021-02-02 10:30:00 | 125 | 12 | +------+---------------------+--------+------+

Linux Basic Command Cheat Sheet

 https://www.guru99.com/linux-commands-cheat-sheet.html Linux Command Cheat Sheet In this Linux/Unix command line cheat sheet, you will learn: Basic Linux commands File Permission commands Environment Variables command User management commands of linux Networking command Process command VI Editing Commands Basic Linux commands Command Description ls Lists all files and directories in the present working directory ls -R Lists files in sub-directories as well ls -a Lists hidden files as well ls -al Lists files and directories with detailed information like permissions,size, owner, etc. cd or cd ~ Navigate to HOME directory cd .. Move one level up cd To change to a particular directory cd / Move to the root directory cat > filename Creates a new file cat filename Displays the file content cat file1 file2 > file3 Joins two files (file1, file2) and stores the output in a new file (file3) mv file "new file path" Moves the files to the new location mv filename new_file_name Re...