Blog

MySQL – OUTFILE – Table Data to File

The SELECT… INTO OUTFILE statement is meant to allow the server host to dump a table to a text file. SELECT… INTO OUTFILE is the opposite of LOAD DATA. Column values are written in the character set supplied in the CHARACTER SET clause. If no such clause is present, values are dumped using the binary…

Backup a single table – MySQL

It is occasionally necessary to take a table backup before applying data corrections or structural modifications to a table. In the event of a problem, the table backup assists in restoring normalcy. There are numerous ways to accomplish this in MySQL, as discussed in this post. Using MySQLdump mysqldump -u <username> -p<password> -h host db_name…

Dynamic SQL – Export Data

As specified in the previous post, the method we use to write SQL queries so that they are dynamically built alongside application actions is known as “dynamic SQL.” In other words, With dynamic SQL, you can create software that makes use of SQL statements whose entire text won’t be known until runtime. Dynamic SQL allows…

Error Handling – RAISERROR

In my earlier essay, I discussed SQL Server’s error handling in great detail. This is a follow-up post; it discusses RAISERROR, which produces an error message and initiates the session’s error processing. The user-defined message stored in the sys.messages catalog view may be referred to by RAISERROR, or a dynamic message may be created. Syntax:RAISERROR…

Error Handling – Introduction

In SQL Server, error handling (also known as exception handling) offers us control over the Transact-SQL code and aids in diagnosing the precise point where it failed. The only function of this method is to report the cause of failure. Due to this, we will be able to figure out what went wrong and rectify…

LOAD DATA INFILE – MySQL – Errors

Rows from a text file are quickly read into a table using the LOAD DATA statement. Depending on whether the LOCAL modifier is specified, the file can be read from either the server host or the client host. Data interpretation and error handling are also impacted by LOCAL. Nevertheless, after resolving one problem, I continued…

FULL OUTER JOINS in MySQL?

The SQL FULL OUTER JOIN combines two tables based on a common column and chooses records from both tables that match the values of the matching columns as well as any remaining rows.In other words, the FULL OUTER JOIN in SQL combines the outcomes of both left and right outer joins and returns all rows…

Using a User Defined Function while adding a column

I tried to figure out how to add the computation expression for a computed column using a user-defined function that I discovered while visiting an online forum. Here’s an illustration. — Create a table CREATE TABLE dbo.Products ( ProductID int IDENTITY (1,1) NOT NULL , QtyAvailable SMALLINT, UnitPrice MONEY); — Data insertion INSERT INTO dbo.Products…

Can we alter the computed column in SQL Server

Can we alter a computed column in SQL Server? The answer is- NO. A calculated column is basically a virtual column that isn’t physically stored in the table, and its underlying expression cannot be changed. You’ll have to start anew and throw it out. CREATE TABLE dbo.Products ( ProductID int IDENTITY (1,1) NOT NULL ,…

SQL Server – Practice CASE Expression

The CASE expression is frequently used in day-to-day tasks, particularly when preparing reports and conducting data analyses. It analyzes a set of conditions and provides one of many possible result expressions. When the first condition is satisfied, the CASE expression iterates over conditions and returns a value (like an if-then-else statement). Therefore, it will stop…

Loading…

Something went wrong. Please refresh the page and/or try again.


Follow My Blog

Get new content delivered directly to your inbox.