An Introduction To T SQL Server
Posted By : Annu Sehrawat | 27-Aug-2020
Database
A database is an organized collection of data. It is the gathering of schemes, tables, queries, reports, views, and other objects.
Relational Database
A relational database consists of a set of tables that stores particular Sets of data.
Creating a database
Create a new Database and therefore the file used to store the database.
Syntax:-
|
database_name:- database_name is often a maximum of 128 characters. Unless a logical name isn’t specified for the log file. If a logical log file name isn’t specified, SQL Server generates the logical_file_name and therefore the os_file_name for the log by appending a suffix to database_name. This limits database_name to 123 characters in order that the generated logical file name is not any quite 128 characters.
Creating a database that specifies data and transaction log files.
|
Drop database
Remove one or more user Databases from an Instance of SQL Server.
Syntax:-
|
database_name:- Specifies the name of the database to be removed. To display an inventory of databases, use the sys.databases catalog view.
Dropping multiple databases:
|
Alter database
Modifies a database, or the files and filegroups related to the database. Adds or removes filegroups from a database and modifies the elements of a database or its files and filegroups, changes the database collation, and sets database options.
Syntax:-
|
OldDatabase_Name:- Is that the name of the database to be modified?
MODIFY NAME:- Renames the database with the name specified as New Database_Name.
Example:
|
Data Definition Language (DDL)
Data Definition Language (DDL) is a vocabulary wont to define data structures in SQL Server. Use the following statements to create, alter, or drop data structures in an instance of SQL Server.
Create Command
Create command is additionally used to create a table. We can define names and data types of various columns along.
Syntax:-
|
RenameCommand
Rename command is employed to rename a table.
Syntax:-
|
AlterCommand:
- To add a column to an existing table.
Syntax:-
|
- To modify an existing column.
Syntax:-
|
- To rename the column.
Syntax:-
|
- Alter is additionally used to drop a column.
Syntax:-
|
Drop Command:
The Drop query completely removes a table from databases.
Syntax:-
|
Truncate Command:
The Truncate command removes all records from a table. But this command will not demolish the table's structure
Syntax:-
|
Data Manipulation Language (DML)
Data Manipulation Language (DML) is a vocabulary wont to retrieve and work with data in SQL Server. Use the following statements to add, modify, query, or remove data from a SQL Server database.
Insert Command:
Insert command is employed to insert data into a table.
Syntax:-
|
Example: A table student with the following fields.
Insert a record into the student table.
Update Command:
The Update command is employed to update a row of a table.
Syntax:-
|
Delete Command:
Delete command is used to delete the data from a table. Delete command can also be used with the condition to delete a specific row.
Syntax:-
|
We are a 360-degree SaaS app development company that focuses on building high-quality web and mobile applications using the latest tools, frameworks, and SDKs. Our development team analyzes your project requirements and formulates effective strategies to create performance-driven applications that maximize enterprise benefits. We have successfully completed several full-scale SaaS application development projects with a focus on next-gen technologies. For project-related queries, reach us out at [email protected].
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Annu Sehrawat
Annu Sehrawat is an accomplished backend developer with 3.5 years of experience in PHP, JavaScript, Laravel, WordPress, MySQL, and programming. She has a demonstrated ability to design and implement reliable, efficient, and high-quality solutions. She also has a strong background in management and leadership, which has helped her to effectively manage teams and projects. She has worked on a variety of projects, including Kofaa Platform using Wordpress, Helpdesk using Laravel framework, Freshdesk using Laravel framework, Project P using Laravel technology, and Pandocore using Wordpress technology.