Skip to main content

Posts

Showing posts with the label Best SQL Query for Happy New Year [SQL Query]

191 SQL Create Country Table & Insert Countries Data [How To]

In this post, I am sharing the SQL Script for “ Create Country Table & Populate All Country Names ” using SQL Server and this script containing “ Id ”, “ county code ”, “ county name ” and “ nationalities ”. First, we will need to create a table “ Counties ” and after will need to create “ INSERT ” countries query i.e. 1.       CREATE TABLE 2.       INSERT COUNTRY ROWS Stayed Informed - SQL Server Tutorials | SQL Server Interview Questions Examples as, --CREATE TABLE COUNTRIES GO CREATE TABLE [dbo].[Countries]( [Id] [ int ] IDENTITY ( 1 , 1 ) NOT NULL , [CountryID] [ char ]( 10 ) NOT NULL , [CountryName] [nvarchar]( 100 ) NULL , [Nationality] [nvarchar]( 100 ) NULL , CONSTRAINT [PK_country] PRIMARY KEY CLUSTERED ( [Id] ASC ) WITH (PAD_INDEX = OFF , STATISTICS_NORECOMPUTE = OFF , IGNORE_DUP_KEY = OFF , ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON ) ON [ PRIMARY ] ) ON [ PRIMARY ] GO...

Best SQL Query for Happy New Year [SQL Query]

In this article, I will explain some general SQL Server “Queries”. I think most of each developer wants to write a query to PRINT “ Happy New Year ” and sent to developers and team for their BEST WISHES. Due to this, I am tried to write a “ SQL Query ” and sharing with you! If you have any other smart query related to this (You can share to me and I will re-publish this post with your query!) The Query Example As, -- Simple Query SELECT CAST ( 0 X4861707079204E65772079656172 AS VARCHAR ( 100 )) AS 'Result' -- OR -- Some Stylish Query SELECT SPACE (TOTAL - LEN(REPLICATE( CHAR (CHARACTERS), NO ))) + REPLICATE( CHAR (CHARACTERS), NO * 2 - 1 ) as 'HappyNewYear' FROM ( SELECT TOP 5 ROW_NUMBER() OVER ( ORDER BY name) AS NO , 15 AS total, 214 AS CHARACTERS FROM sysobjects ) AS T UNION ALL SELECT SPACE ( 10 ) + CAST ( 0 X4861707079204E65772079656172 AS VARCHAR ( 100 )) Results :- Happy New year ...