Results for "Select"
14 / 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…
Find column in the whole database in sql server
To find a specific column in the whole database in SQL Server, you can query the information schema views. Here's a query you can use: SELECT table_name, c…
UNION, UNION All, INTERSECT, EXCEPT used in SQL Server
UNION : The UNION operator is used to combine the result sets of two or more SELECT statements into a single result set. It removes duplicate rows from the…
Order by index number in SQL
SELECT empid, lastname FROM HR.Employees ORDER BY 1 DESC --order by first column SELECT empid, lastname FROM HR.Employees ORDER BY 2 DESC --order by second…
Filtering the data with TOP and OFFSET-FETCH In SQL
TOP: SELECT TOP (5) productid, unitprice FROM Production.Products WHERE categoryid = 1 ORDER BY unitprice DESC; SELECT TOP (5) WITH TIES productid, unitpri…
PaySpark Data manipulation
Select Table into dataframe: df = spark.read.table(tableName="samples.tpch.customer").limit(5) df = spark.table(tableName="samples.tpch.customer").limit(5)…
ALLSELECTED Function in Power BI
ALLSELECTED : The ALLSELECTED function in DAX is used to return all the rows in a table, or all the values in a column . This is particularly useful in sce…
Split full name into first name and last name in SQL
Split full name into first name and last name : SELECT EmployeeName, CASE WHEN CHARINDEX(' ', EmployeeName) > 0 -- Check if there is a space (indicating…
What is the KDD (Knowledge Discovery in Databases)
In today's world, data is everywhere. Businesses, healthcare, banking, and even social media generate vast amounts of data every second. But raw data alone…
select() Function in PySpark
In PySpark, select() function is used to select single, multiple, column by index, all columns from the list and the nested columns from a DataFrame, PySpa…
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…
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…