SQL ENTRY AND PREPARING SQL QUERIES

SQL

SQL is a programming language used to manage relational databases and query data. Data in many different types of databases, especially relational databases, are managed using SQL. Today, SQL is supported by most database management systems. In this learning content, we will look at SQL in detail.

SQL (Structured Query Language) is a programming language used to manage relational databases and query data. Data in many different types of databases, especially in relational databases, is managed using the SQL language. Today, SQL is supported by most database management systems (DBMS).

SQL is used to create tables where data is stored, change their structure, add data to these tables, edit, update, select, and delete data. SQL queries, which often involve querying, adding, updating, or deleting data, include commands such as SELECT, INSERT, UPDATE, and DELETE.

Data Types in SQL

When storing data in a database, as in programming languages, definitions appropriate to the structure of the data must be made. Choosing the right data type according to our needs is very important for a proper design.

Textual Data Types

  • char: Defined as char(n) to indicate a number of characters, it does not support Unicode. They can take values up to 8000 characters. It uses memory as much as the specified character, even if fewer characters are entered in the data.
  • nchar: Supports Unicode. Unlike the char data type, it can take values up to 4000 characters.
  • varchar: Unlike the char data type, it only takes up space according to the size of the data. It stores up to 8000 characters.
  • nvarchar: Takes up memory as much as the data size. Unlike the varchar data type, it supports Unicode and can take values up to 4000 characters.
  • text: It takes up space as its size, even if less data is entered.
  • ntext: Unlike the text data type, it takes up space according to the size of the entered character and supports Unicode.

Binary Data Types

  • binary: A binary base data type representing 1s and 0s.
  • varbinary: Unlike binary, it takes up space only according to the entered character.
  • image: Used to store image files.

Numeric Data Types

  • bit: An integer data type that is one byte long.
  • tinyint: An integer data type used for whole numbers between 0–255, with a size of 1 byte.
  • smallint: An integer data type that can take values between -32,768 and 32,768, with a size of 2 bytes.
  • int: An integer data type that can hold values between -2 billion / +2 billion, with a size of 4 bytes.
  • bigint: An integer data type with a size of 8 bytes that can hold values between -2⁶³ and 2⁶³.

Date-Time Data Types

  • date: Stores dates in the YYYY-MM-DD (year-month-day) format. It's a 3-byte data type.
  • datetime: An 8-byte data type that stores date and time in YYYY-MM-DD format. Used for dates between January 1, 1753, and December 31, 9999.
  • time: Stores only hour data in hour-minute-second-millisecond (7 digits) format, a data type that occupies between 3–5 bytes, the size of which can be changed by the user.

The above lists the commonly used basic data types. Different DBMSs have data types other than these.

MSSQL (Microsoft SQL Server)

MSSQL (Microsoft SQL Server) is a relational database management system (RDBMS) developed and managed by Microsoft. MSSQL runs on Windows operating systems and has many different versions.

Like other RDBMSs, MSSQL uses SQL (Structured Query Language). MSSQL offers many features such as transaction management, workload management, security, backup, and restore. These features ensure the preservation of data integrity, high-level data security, and improved performance.

MSSQL offers various tools for database management. Among these are SQL Server Management Studio (SSMS) and SQL Server Data Tools (SSDT). SSMS is a tool that allows you to connect to the MSSQL server and manage databases. SSDT is a tool that facilitates the database development process.

MSSQL is used in many different sectors and businesses. Especially in large-scale enterprises and organizations, RDBMSs like MSSQL are of critical importance for managing and analyzing large amounts of data.

With the information provided, we have taken a step further in our relationship with SQL and MSSQL. In the next learning content, we will focus on SQL and TSQL operations with Null and spaces.

SQL is a programming language used to manage relational databases and query data. Data in many different types of databases, especially relational databases, are managed using SQL. Today, SQL is supported by most database management systems. In this learning content, we will look at SQL in detail.

SQL (Structured Query Language) is a programming language used to manage relational databases and query data. Data in many different types of databases, especially in relational databases, is managed using the SQL language. Today, SQL is supported by most database management systems (DBMS).

SQL is used to create tables where data is stored, change their structure, add data to these tables, edit, update, select, and delete data. SQL queries, which often involve querying, adding, updating, or deleting data, include commands such as SELECT, INSERT, UPDATE, and DELETE.

Data Types in SQL

When storing data in a database, as in programming languages, definitions appropriate to the structure of the data must be made. Choosing the right data type according to our needs is very important for a proper design.

Textual Data Types

  • char: Defined as char(n) to indicate a number of characters, it does not support Unicode. They can take values up to 8000 characters. It uses memory as much as the specified character, even if fewer characters are entered in the data.
  • nchar: Supports Unicode. Unlike the char data type, it can take values up to 4000 characters.
  • varchar: Unlike the char data type, it only takes up space according to the size of the data. It stores up to 8000 characters.
  • nvarchar: Takes up memory as much as the data size. Unlike the varchar data type, it supports Unicode and can take values up to 4000 characters.
  • text: It takes up space as its size, even if less data is entered.
  • ntext: Unlike the text data type, it takes up space according to the size of the entered character and supports Unicode.

Binary Data Types

  • binary: A binary base data type representing 1s and 0s.
  • varbinary: Unlike binary, it takes up space only according to the entered character.
  • image: Used to store image files.

Numeric Data Types

  • bit: An integer data type that is one byte long.
  • tinyint: An integer data type used for whole numbers between 0–255, with a size of 1 byte.
  • smallint: An integer data type that can take values between -32,768 and 32,768, with a size of 2 bytes.
  • int: An integer data type that can hold values between -2 billion / +2 billion, with a size of 4 bytes.
  • bigint: An integer data type with a size of 8 bytes that can hold values between -2⁶³ and 2⁶³.

Date-Time Data Types

  • date: Stores dates in the YYYY-MM-DD (year-month-day) format. It's a 3-byte data type.
  • datetime: An 8-byte data type that stores date and time in YYYY-MM-DD format. Used for dates between January 1, 1753, and December 31, 9999.
  • time: Stores only hour data in hour-minute-second-millisecond (7 digits) format, a data type that occupies between 3–5 bytes, the size of which can be changed by the user.

The above lists the commonly used basic data types. Different DBMSs have data types other than these.

MSSQL (Microsoft SQL Server)

MSSQL (Microsoft SQL Server) is a relational database management system (RDBMS) developed and managed by Microsoft. MSSQL runs on Windows operating systems and has many different versions.

Like other RDBMSs, MSSQL uses SQL (Structured Query Language). MSSQL offers many features such as transaction management, workload management, security, backup, and restore. These features ensure the preservation of data integrity, high-level data security, and improved performance.

MSSQL offers various tools for database management. Among these are SQL Server Management Studio (SSMS) and SQL Server Data Tools (SSDT). SSMS is a tool that allows you to connect to the MSSQL server and manage databases. SSDT is a tool that facilitates the database development process.

MSSQL is used in many different sectors and businesses. Especially in large-scale enterprises and organizations, RDBMSs like MSSQL are of critical importance for managing and analyzing large amounts of data.

With the information provided, we have taken a step further in our relationship with SQL and MSSQL. In the next learning content, we will focus on SQL and TSQL operations with Null and spaces.

Yardımcı kaynaklar

Glossary