How-to Install SQL SERVER


Hey visitors today we are continuing our SQL series in the previous part we learned about the intro of SQL

today we will continue with the series.

 How to download SQL


Click on the free download for sql server management studio.

after downloading click on the install button and install it.

after installation Go to https://www.microsoft.com/en-in/sql-server/sql-server-downloads for Microsoft SQL server download.


OPEN THE DOWNLOADED FILE



SELECT THE BASIC ONE


ACCEPT T&C

after accepting the terms and conditions you need to set the directory where you want to download.


after installation, you see this interface on your screen.


CLICK ON CONNECT NOW button.


COMPETENCE WINDOW.
OPEN YOUR SSMS(SQL SERVER MANAGEMENT STUDIO) on your system.


click CONNECT Button.

YOU ARE READY TO GO 

Now we are starting with the SQL 

1. Database

In MS SQL Server, two types of databases are available.

  • System database
  • User Databases

System Databases

System databases are created automatically when we install MS SQL Server.

Following is a list of system databases −

  • Master
  • Model
  • MSDB
  • Tempdb
 User Databases 

User databases are created by users (Administrators,
developers, and testers who have access to create databases).

Method 1– Using T-SQL Script Create database <yourdatabasename>.


Method 2 – Using SQL Server Management Studio 

right-click on the databases folder. Click on the new database and the following screen will appear.

Write the database name and click ok.


New Database

Enter the database name field with your database name (example: to create a database with the name ‘GUERILLATECK’)

and click OK. GUERILLATECK database will be created.

After creating database


DELETE A DATABASE

To remove your database from MS SQL Server, use drop database command. The following two methods can be used for this purpose.

Method 1 – Using T-SQL Script

Following is the basic syntax for removing database from MS SQL Server.

Example:-


To remove the database name 'GUERILLATECK’, run the following query

Drop database <GUERILLATECK>



All Databases after deletion

Tables in SQL.

Note *-before creating the table we have to run the following query because it is default selected to master(system-made database name) so we have to change it to our database

Syntax:- use<yourdatabasename>

For eg:-

In SQL, a table is a collection of data organized in rows and columns. Tables are used to store data and represent real-world entities or concepts.

To create a table in SQL, you use the CREATE TABLE statement. The basic syntax for creating a table is as follows:



CREATE TABLE table_name (

    column1 datatype,

    column2 datatype,

    column3 datatype,

);

for eg:-



Insertion of values in the table 

  INSERT statement in SQL Server is used for adding records in a table within the specified database.

Syntax:-

INSERT INTO <table name> 
VALUES (value1, value2, ... );

For example:-


Output:-


Data had entered successfully

Drop a table

To drop a table in SQL, you use the DROP TABLE statement followed by the name of the table you want to drop. The basic syntax for dropping a table is as follows:

DROP TABLE table_name;




Note that when you drop a table, all data and indexes associated with the table will also be deleted. Therefore, it is important to use caution when dropping tables to avoid losing important data. It is also a good practice to back up your data regularly to prevent data loss in case of accidental drops or other disasters.

SQL delete rows condition

The SQL statement is used to delete one or more rows from a table in a relational database.

Syntx:-"DELETE FROM table_name [WHERE condition];"

No comments:

Post a Comment