SQL Tutorials – online choices for SQL Server Tutorials

Some of the top on-line sql tutorial are available at Tutorial point, w3 schools, and Java. These are the top 3 contenders in sql tutorial top spots as in Google search list in terms of popularity and authority. There are several others available. Any sql tutorial usually provides an overview of the standardized query language that you could use to query, retrieve and manage data in relational databases. These are designed in such a way that even beginners can go through them and gain in expertise as they progress through these courses. The only prerequisites required of learners of sql tutorial is an understanding of what a database, RDBMS is, and what constitutes a programming language, its structure and how does programming language used to construct a program.

Once a learner is generally proficient in SQL, through the use of one of these sql tutorial, he/she is able to work with any of the many databases in heavy use. These include SQL Server, MySQL, Sybase, DB2, Oracle, Access and many others. Obviously, learning SQL would not help you with the new-fangled “no sql” databases.

Many of these sql tutorial offer certification. Candidates are given certificates based on clearing periodic examinations. These certificates accepted by employers as proof of the person being qualified in the SQL programming language.

SQL Tutorial-choices to learn sql online

Every sql tutorial is structured. The structure may be slightly different depending on which sql tutorial you are going to use. Lets take a closer look on some of the sql tutorial available:

  • The top choice in sql tutorial is the on-line course conducted by the Tutorial point. They start their sql tutorial with an overview. This is followed by RDBMS and database concepts. SQL statement syntax and the data types handled are introduced next. The sql tutorial then take the learner through operators, expressions. “Create”, “drop” and “select database statements are then introduced. Table manipulations, insert and select queries, “where” clauses are then introduced. Combining queries, update, delete, like, top clauses are talked about. “distinct” keyword and sorting of results are illustrate. After that advanced features such as Constraints, joins, unions and such others are introduced. Then sql tutorial informs about best practices, questions & answers. They even have a section on HR questions the candidates may have to face while interviewing for a job. Additional reading is suggested too.
  • Sql tutorial by w3 schools is well respected as well. W3 schools offer on-line courses in a very wide range of technologies in computers and the Internet. The w3schools has a little different structure of the material than Tutorial point. It discusses various SQL statement types and data types. The sql tutorial then progresses into a coverage of the functions available. This tutorial too has a quiz section but does not have the “interview” questions of the Tutorial point’s.
  • The sql tutorial from JavaTPoint is another widely used robust technology. It provides web service tutorials for beginners and professionals and has yet another structure.

Take your time to get familiar with different options available. Make your deliberated decision considering your priorities and goals.

Please don’t hesitate to contact us if you have any questions regarding sql tutorial. We, at  SQL Server Tutorial, always happy to help!

 

 

Delete all the user tables in SQL Server 2012

At times we need to delete all the user tables in a SQL Server 2012 database. Why do we need to do that? This may happen if:

  • The data is used for analysis or reporting
  • You are reloading tables every night via a batch
  • There could be application development or testing
  • We have a need to delete objects for a certain schema

 

So this means we have to keep the database intact, just need to drop the tables. There may be other objects like stored procedures, views, user logins and even SQL jobs associated with the database. How do we do that, I mean keep the database but zap all the user tables. Well there are really two options. One is to do it the “old fashioned” way, delete a table one at a time. The other is more elegant and uses TSQL to delete all the user tables in SQL Server 2012. Since we also belong to the Lazy DBA Association, we are going to use TSQL to achieve the end result. We will be doing the following:

  1. Create a temp table
  2. Insert the list of tables into this temp table
  3. Loop through list of tables and zap them one at a time

Note; Make sure the Referential Integrity is disabled, otherwise this will not work

 

use Northwind_test

–declaration of variables

declare
@init_count int,
@rec_count int,
@total_count int,
@table_name varchar(1000),
@sql_stmt varchar(1000)

–create temp table #tmp_tables, more info in another script

create table #tmp_tables
(id int identity(1,1),
tablename varchar(50)
)

–insert into temp table #tmp_tables

insert into #tmp_tables (tablename)
SELECT TABLE_SCHEMA + ‘.’ + TABLE_NAME
FROM information_schema.tables
where TABLE_TYPE=‘base table’

set @init_count=1
select @total_count=count(*) from #tmp_tables
set @rec_count=@init_count

print @init_count
print @rec_count
print @total_count

–while loop to go through the tables

while @rec_count < @total_count

begin
select @table_name= tablename from #tmp_tables where id=@rec_count
select @sql_stmt=‘drop table ‘ + @table_name
–print @table_name
print @sql_stmt
exec (@sql_stmt)

set @rec_count=@rec_count + 1
end

drop table #tmp_tables
/* Sample output

drop table dbo.Employees
drop table dbo.Categories
drop table dbo.Customers
drop table dbo.Shippers
drop table dbo.Suppliers
drop table dbo.Orders
drop table dbo.Products
drop table dbo.Order Details
drop table dbo.CustomerCustomerDemo
drop table dbo.CustomerDemographics
drop table dbo.Region
drop table dbo.Territories
drop table dbo.EmployeeTerritories
drop table dbo.Customers_All

*/

 

Transact SQL scripts – SQL 2012 Video Tutorials

As part of the SQL 2012 Video Tutorials – Unlimited Package, you will have to access to Transact SQL (TSQL) scripts. These will help you in understanding SQL 2012 and how to work with objects in MS SQL 2012 database environment. Some of the SQL scripts are used to create objects like database, table, indexes, primary keys and foreign key constraints. Other SQL statements include the DML commands like: INSERT, SELECT, UPDATE AND DELETE. Here’s a list of SQL statements so far:

(Note: The ones with active links can be downloaded for FREE!)

Transact SQL scripts:


 

More information on this can be found on this page SQL 2012 Video Tutorials – Unlimited Package.

 

 

 

Follow us on: