Results for "Create"
26 / 184 posts
Added columns in a table by dynamic ways
IF OBJECT_ID('AddedDynamicColumn','P') IS NOT NULL BEGIN DROP PROC AddedDynamicColumn END GO CREATE PROCEDURE AddedDynamicColumn AS BEGIN SELECT ED.empid,E…
How to get first date of given date or month.
Get First date of month: SELECT DATEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), 1) AS FirstDayOfCurrentMonth Create function for that IF NOT EXISTS (SELEC…
How to one series with comma separate(any Delimiter) value split into in rows
If we have one series with comma separate(any Delimiter) value and we want split into in rows, I have create function for that: IF OBJECT_ID('TF_SplitSerie…
How to Two series with comma separate(any Delimiter) value split into in rows respectively
If we have two series with comma separate(any Delimiter) value and we want split into in rows, I have create function for that: IF OBJECT_ID('TF_SplitTwoSe…
How to use Magic (virtual) table INSERTED and DELETED in SQL server
Magic Tables are virtual tables that are automatically created and maintained by SQL Server for each data modification operation performed on a table. They…
How to get first date From month and Finyear
If we have Finyear and month then we create a date for examples: DECLARE @finyear CHAR(5) = '202425'; DECLARE @month smallint = 5; --Get Year DECLARE @year…
Insert <br> tag in SQL text string
CREATE or ALTER FUNCTION dbo.Fn_InserBRtag(@inputString NVARCHAR(MAX)) RETURNS NVARCHAR(MAX) AS BEGIN DECLARE @resultString NVARCHAR(MAX) = ''; DECLARE @st…
Spark SQL useful command
Spark SQL provides a variety of commands for managing databases, tables, and performing SQL operations. CREATE DATABASE IF NOT EXISTS demo; SHOW DATABASES;…
DateTime in Python
In Python, the datetime module provides classes for manipulating dates and times. It offers several functions and methods to create, manipulate, and format…
How to Create table in Power BI using Dax
ROW: The ROW function in DAX creates a single row table with the specified columns and values. ROW(columnName1, value1, [columnName2, value2], ...) Si…
SQL MERGE statement
CREATE DATABASE SqlShackMergeDemo GO USE SqlShackMergeDemo GO CREATE TABLE SourceProducts( ProductID INT, ProductName VARCHAR(50), Price DECIMAL(9,2) ) GO …
PartitionBy() in PySpark
partitionBy() एक function है जो DataFrame को disk par likhne (write) के time par use hota hai. ये function pyspark.sql.DataFrameWriter class ka part hai. �…
Store Error Logs In SQL
Create Table for Error log: CREATE TABLE [dbo].[ErrorLog]( [ErrorLogID] [int] IDENTITY(1,1) NOT NULL, [ErrorTime] [datetime] …
Database trigger to audit (Transaction logs) all of the DDL changes made to the Database
Create table DatabaseLog: CREATE TABLE [dbo].[DatabaseLog]( [DatabaseLogID] [int] IDENTITY(1,1) NOT NULL, [PostTime] [datetim…
Addition, subtraction, multiplication, and dot product using NumPy in Python:
Here are some examples of addition, subtraction, multiplication, and dot product using NumPy in Python: import numpy as np # Create two arrays a = np.array…
Stored Procedure in MySQL
Syntax for Creating a Stored Procedure DELIMITER // CREATE PROCEDURE procedure_name (IN param1 data_type, OUT param2 data_type) BEGIN -- SQL statements END…
Understanding DataFrames in PySpark
DataFrames are an important data structure in PySpark. They help in handling structured and semi-structured data efficiently. DataFrames are like tables in…
withColumn() in Pyspark
PySpark withColumn() is a transformation function of DataFrame which is used to change the value, convert the datatype of an existing column, create a new …
where() & filter() in PySpark
The filter() function in PySpark is used to create a new DataFrame by selecting rows that meet a specified condition or SQL expression. Alternatively, the …
PySpark Built-in Functions
These functions are commonly used with groupBy() , agg() , or select() to compute things like sum, average, max, min, count, etc. PySpark functions come fr…
PySpark SQL Date and Timestamp Functions
🔧 Setup First (Optional for Reference) from pyspark.sql import functions as F from pyspark.sql import types as T data = df = spark.createDataFrame(data, )…
File Handling(create, read, write, and delete files etc.)
File Handling in Python allows us to create, read, write, and delete files . It's an essential feature when working with data that needs to be stored perma…
Table Types Comparison: SQL Server vs PostgreSQL
Table Type SQL Server PostgreSQL Scope / Lifetime Usage Notes Permanent Table CREATE TABLE Employee (...) CREATE TABLE Employee (...) Permanent in DB until…
Statistics in SQL Server
Statistics SQL Server ke “mind” jaise hote hain. Ye SQL Server ko batate hain ki table me data kis tarah se distribute hai — jaise kitne values unique hain…
What is “CREATE TABLE TYPE” in SQL Server?
Ye ek User-Defined Table Type (UDTT) hota hai. Aap SQL Server me ek custom table ka design bana lete ho, jise aap baad me Stored Procedures, Functions, aur…
Dynamic CREATE TABLE Script in SQL Server
DECLARE @TableName NVARCHAR(100) = 'Employee'; DECLARE @SQL NVARCHAR(MAX) = ''; DECLARE @PKCols NVARCHAR(MAX) = ''; -- Get Primary Key Column(s) SELECT @PK…