Curso de SQL Server 2021 desde cero | SELECT TOP,  SELECT PERCENT  (video 17)

Curso de SQL Server 2021 desde cero | SELECT TOP, SELECT PERCENT (video 17)

How to Select Records in SQL Server Without Filters

Introduction to SQL Queries

  • The video introduces a course on SQL Server, focusing on how to perform queries without using filters. The example used is the "empleados" (employees) table.

Using the TOP Clause

  • To select a specific number of records regardless of their values, the TOP clause is utilized. For instance, SELECT TOP 5 * FROM empleados; retrieves the first five records from the table.
  • The TOP clause can also accept percentages. For example, using SELECT TOP 50 PERCENT * FROM empleados; returns approximately half of the total records in the table.

Understanding Approximate Results

  • When requesting a percentage of records, results may vary slightly due to rounding. In this case, retrieving 50% returned rows 1 through 7 out of an approximate total of 14 rows.

Filtering with TOP Clause

  • The TOP clause can be combined with filters. An example query like SELECT TOP 3 * FROM empleados WHERE activo = 'no'; fetches the first three inactive employees.
Video description

Seleccionar una cantidad de filas especificas sin importar los datos y seleccionar un porcentaje de datos de nuestras tablas. CONTACTO: informaticonfig@gmail.com COLABORACION: paypal.me/informaticonfig patreon.com/informaticonfig