From below query you will get the number of data present in each table of databases. Most consume table data. –created the temp table to store the tables data sizeCREATE TABLE #DBEachTable (TableName sysname ,RowCounts INT,ReservedSize VARCHAR(50),DataSize VARCHAR(50),IndexSize VARCHAR(50),UnusedSize VARCHAR(50)) –insert the tables data in created temp tableINSERT #DBEachTableEXEC sp_msforeachtable ‘sp_spaceused ”?”’ –fetching the eachContinue reading “SQL – Find number Rows, Columns for each table in the database”
In below query, We can view the relationships between more than one table as primary and foreign key … SELECT PK_Table = PK.TABLE_NAME,PK_Column = PT.COLUMN_NAME,K_Table = FK.TABLE_NAME,FK_Column = CU.COLUMN_NAME,Constraint_Name = C.CONSTRAINT_NAMEFROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS CINNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS FK ON C.CONSTRAINT_NAME = FK.CONSTRAINT_NAMEINNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS PK ON C.UNIQUE_CONSTRAINT_NAME = PK.CONSTRAINT_NAMEINNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CU ON C.CONSTRAINT_NAME = CU.CONSTRAINT_NAMEINNER JOINContinue reading “SQL – Display Primary and Foreign Key Relationships Table With Their Constraints”
In below sections there are basics sql queries about SELECT , WHERE , AND OR NOT , INSERT … There are other query commands also those we will see in the Next blog … SELECT Select command is use for to get the data from the table Example: SELECT * FROM tablename The above exampleContinue reading “SQL BASIC COMMANDS”
What is SQL ?SQL is Structured Query Language . This is a standard language used to perform tasks such as INSERT/UPDATE/DELETE and SELECT of data from a database. What is Database ?Database is nothing but an organized form of data for easy access, storing, retrieval and managing of data. Constraints in SQL ?NOT NULL –Continue reading “Top 10 SQL Interview Questions”
In a SQL Server there is two things Blocking and Locking. Today will check about blocking. There are number of ways to find out the details of the system processes IDs (spids) involved in blocking. I have tried to cover some of the options in this tip to include: sp_who2 System Stored Procedure The sp_who2Continue reading “Identify Block SPs”
Whenever SQL Server needs to perform a query execution additional following Transact-SQL statements are executed: 1) FROM 2) WHERE 3) GROUP BY 4) HAVING 5) SELECT 6) ORDER BY 7) LIMIT We will be give more details about above conditional clauses in next blog…
Index Scan:Index scan touches every row in the table, whether or not it qualifies, the cost is proportional to the total number of rows in the table. Thus, a scan is an efficient strategy if the table is small or if most of the rows qualify for the predicate. A scan is the opposite ofContinue reading “Index Scan vs Index Seek”
Hi every one! My name is Nitin, I live in Mumbai, and a database developer for almost 5+ years (SQL). I started using WordPress for a SQL blog sql.tech.blog … So that was my real first approach with WordPress as a user. I started to have an interest as a developer.