Coalesce Function in MSSQL

COALESCE is a built-in function in Microsoft SQL Server that returns the first non-null expression among its arguments. It takes one or more expressions as arguments and returns the value of the first expression that is not NULL. If all the expressions are NULL, it returns NULL. Continue reading Coalesce Function in MSSQL

Pivot Function in MSSQL

In SQL Server, the PIVOT function is used to transform rows into columns. The PIVOT function is a T-SQL operator that rotates a table-valued expression by turning the unique values from one column in the expression into multiple columns in the output, effectively creating a cross-tabulation of the data. Here’s an example to help illustrate the concept: Continue reading Pivot Function in MSSQL

CTE (Common Table Expression) in SQL

CTE (Common Table Expression) is a feature in SQL that allows you to define a temporary result set that can be used within a SELECT, INSERT, UPDATE, or DELETE statement. A CTE is similar to a derived table or subquery, but has some advantages over those techniques, including improved readability, reusability, and optimization opportunities. Continue reading CTE (Common Table Expression) in SQL

SQL Window Functions

SQL Window Functions are a feature of SQL that allow you to perform calculations across rows within a set of rows, called a “window”. The window is defined using the “OVER” clause and can be used to perform operations such as ranking, cumulative sums, running totals, and more. These functions provide a more concise and efficient way to perform calculations that would otherwise require complex subqueries or self-joins.

Continue reading SQL Window Functions

What is SQL Alchemy and Alembic?

SQLAlchemy is a popular Python library for working with databases. It provides a set of high-level API’s for connecting to and interacting with various types of databases, including relational databases such as MySQL, PostgreSQL, and SQLite, as well as non-relational databases like MongoDB. It also includes an ORM (Object-Relational Mapping) component, which allows developers to interact with the databases using Python objects, rather than writing raw SQL queries. This can make working with databases more efficient and less error-prone.

Continue reading What is SQL Alchemy and Alembic?

Mevcut veritabanı tablolarını değiştirmek

PHP ile mevcut veritabanı tablolarını değiştirmekAz önce ihtiyacım üzerine phpmyadmin’de varsayılan vertabanı türünü değiştirmek isimli bir yazı yayınlamıştım. Bu yazıdan sonra geçmiş veritabanlarının benzer kazalara kurban gitmemesi için tüm tabloları birlikte değiştirebilmek için ufak bir kod betiği yazdım. Aşağıdaki kod betiği güncel veritabanınızdaki tüm tabloların  türlerini (ya da storage-engine’lerini) MyISAM’a çevirir. Dilerseniz kod içerisindeki sorgu cümlesinden (16. satır) INNODB olarak güncelleyerek de kullanabilirsiniz. İşinize yarayacağını düşünüyorum. Continue reading Mevcut veritabanı tablolarını değiştirmek

phpmyadmin’de varsayılan veritabanı türünü değiştirmek

phpmyadmin default storage engineŞu an bir ihtiyacım üzerinde araştırırken edindiğim bilgiyi hızlıca paylaşacağım. Localhostunuzda veritabanı oluştururken default seçenek olarak MyISAM ya da InnoDB geliyor olabilir. Ve siz default seçeneğin başka bir seçenek olmasını istiyor olabilirsiniz. Continue reading phpmyadmin’de varsayılan veritabanı türünü değiştirmek