Podcast
Questions and Answers
What is the purpose of the CREATE EXTERNAL DATA SOURCE
statement in the provided text?
What is the purpose of the CREATE EXTERNAL DATA SOURCE
statement in the provided text?
What is the purpose of the CREATE EXTERNAL FILE FORMAT
statement in the provided text?
What is the purpose of the CREATE EXTERNAL FILE FORMAT
statement in the provided text?
What is the purpose of the CREATE EXTERNAL TABLE
statement in the provided text?
What is the purpose of the CREATE EXTERNAL TABLE
statement in the provided text?
What is the purpose of the CREATE DATABASE SCOPED CREDENTIAL
statement in the provided text?
What is the purpose of the CREATE DATABASE SCOPED CREDENTIAL
statement in the provided text?
Signup and view all the answers
What is the purpose of the CREATE MASTER KEY
statement in the provided text?
What is the purpose of the CREATE MASTER KEY
statement in the provided text?
Signup and view all the answers
What is the purpose of the SELECT INTO
statement in the provided text?
What is the purpose of the SELECT INTO
statement in the provided text?
Signup and view all the answers
What is the purpose of the JOIN
statement in the provided text?
What is the purpose of the JOIN
statement in the provided text?
Signup and view all the answers
What is the purpose of the PUSHDOWN
option in the CREATE EXTERNAL DATA SOURCE
statement?
What is the purpose of the PUSHDOWN
option in the CREATE EXTERNAL DATA SOURCE
statement?
Signup and view all the answers
What is the purpose of the LOCATION
parameter in the CREATE EXTERNAL DATA SOURCE
statement?
What is the purpose of the LOCATION
parameter in the CREATE EXTERNAL DATA SOURCE
statement?
Signup and view all the answers
What is the purpose of the CREDENTIAL
parameter in the CREATE EXTERNAL DATA SOURCE
statement?
What is the purpose of the CREDENTIAL
parameter in the CREATE EXTERNAL DATA SOURCE
statement?
Signup and view all the answers
What does SQL store for an external table?
What does SQL store for an external table?
Signup and view all the answers
Why is it recommended to provide a three-part name for an external table?
Why is it recommended to provide a three-part name for an external table?
Signup and view all the answers
What happens if the column definitions in an external table don't match the data in the external files?
What happens if the column definitions in an external table don't match the data in the external files?
Signup and view all the answers
In PolyBase, what happens when a query selects from an external table with a specified folder location?
In PolyBase, what happens when a query selects from an external table with a specified folder location?
Signup and view all the answers
What does PolyBase not return when querying from an external table?
What does PolyBase not return when querying from an external table?
Signup and view all the answers
Where is the core-site.xml configuration file located for changing PolyBase settings?
Where is the core-site.xml configuration file located for changing PolyBase settings?
Signup and view all the answers
Which clause defines the external data source (a shard map) that is used for the external table?
Which clause defines the external data source (a shard map) that is used for the external table?
Signup and view all the answers
Which data distribution method indicates that an application-specific method is used to distribute the data?
Which data distribution method indicates that an application-specific method is used to distribute the data?
Signup and view all the answers
Which data type is not supported for columns in external tables for Azure SQL Database?
Which data type is not supported for columns in external tables for Azure SQL Database?
Signup and view all the answers
What is the purpose of the SCHEMA_NAME and OBJECT_NAME clauses?
What is the purpose of the SCHEMA_NAME and OBJECT_NAME clauses?
Signup and view all the answers
Which data distribution method specifies that identical copies of the table are present on each database?
Which data distribution method specifies that identical copies of the table are present on each database?
Signup and view all the answers
What is the purpose of the DISTRIBUTION clause in the CREATE EXTERNAL TABLE statement?
What is the purpose of the DISTRIBUTION clause in the CREATE EXTERNAL TABLE statement?
Signup and view all the answers
What happens if the column definitions, including the data types and number of columns, do not match the data in the external files?
What happens if the column definitions, including the data types and number of columns, do not match the data in the external files?
Signup and view all the answers
Which data distribution method specifies that the data from different tables don't overlap?
Which data distribution method specifies that the data from different tables don't overlap?
Signup and view all the answers
Which clause allows you to configure column name, data type, nullability, and collation for an external table?
Which clause allows you to configure column name, data type, nullability, and collation for an external table?
Signup and view all the answers
Which of the following is true about the DEFAULT CONSTRAINT on external tables in Azure SQL Database?
Which of the following is true about the DEFAULT CONSTRAINT on external tables in Azure SQL Database?
Signup and view all the answers
What is the purpose of using GRANT or REVOKE statements for external tables?
What is the purpose of using GRANT or REVOKE statements for external tables?
Signup and view all the answers
How does SQL Database handle data retrieval from an external data source in an ad hoc query scenario?
How does SQL Database handle data retrieval from an external data source in an ad hoc query scenario?
Signup and view all the answers
What happens to the temporary table created during an ad hoc query against an external table?
What happens to the temporary table created during an ad hoc query against an external table?
Signup and view all the answers
In the import scenario, where does SQL Database store the data retrieved from an external data source?
In the import scenario, where does SQL Database store the data retrieved from an external data source?
Signup and view all the answers
What is a limitation of querying external tables compared to querying regular SQL Server tables?
What is a limitation of querying external tables compared to querying regular SQL Server tables?
Signup and view all the answers
Which Data Definition Language (DDL) statements are allowed on external tables?
Which Data Definition Language (DDL) statements are allowed on external tables?
Signup and view all the answers
Which of the following is the correct syntax for creating a master key in SQL Server?
Which of the following is the correct syntax for creating a master key in SQL Server?
Signup and view all the answers
What is the purpose of creating a database scoped credential in SQL Server?
What is the purpose of creating a database scoped credential in SQL Server?
Signup and view all the answers
Which of the following is the correct syntax for creating an external data source in SQL Server?
Which of the following is the correct syntax for creating an external data source in SQL Server?
Signup and view all the answers
What is the purpose of the PUSHDOWN
option when creating an external data source in SQL Server?
What is the purpose of the PUSHDOWN
option when creating an external data source in SQL Server?
Signup and view all the answers
Which of the following is the correct syntax for creating an external table in SQL Server for Oracle?
Which of the following is the correct syntax for creating an external table in SQL Server for Oracle?
Signup and view all the answers
What is the purpose of the LOCATION
option when creating an external table in SQL Server?
What is the purpose of the LOCATION
option when creating an external table in SQL Server?
Signup and view all the answers
Which of the following is the correct syntax for creating an external file format in SQL Server for Parquet files?
Which of the following is the correct syntax for creating an external file format in SQL Server for Parquet files?
Signup and view all the answers
What is the purpose of the FILE_FORMAT
option when creating an external table in SQL Server?
What is the purpose of the FILE_FORMAT
option when creating an external table in SQL Server?
Signup and view all the answers
Which of the following is the correct syntax for querying a Parquet file stored in S3-compatible object storage via an external table in SQL Server?
Which of the following is the correct syntax for querying a Parquet file stored in S3-compatible object storage via an external table in SQL Server?
Signup and view all the answers
What is the purpose of the sp_data_source_objects
system stored procedure in SQL Server?
What is the purpose of the sp_data_source_objects
system stored procedure in SQL Server?
Signup and view all the answers
What is the purpose of the matching suffix for corresponding data and reason files?
What is the purpose of the matching suffix for corresponding data and reason files?
Signup and view all the answers
Which of the following permissions is not required to create an external table in SQL Server?
Which of the following permissions is not required to create an external table in SQL Server?
Signup and view all the answers
What is the purpose of the DATABASE SCOPED CREDENTIAL
used in the CREATE EXTERNAL TABLE
command?
What is the purpose of the DATABASE SCOPED CREDENTIAL
used in the CREATE EXTERNAL TABLE
command?
Signup and view all the answers
When using an external table to export data to a Hadoop or Azure Storage external data source, what additional permission is required for the login specified in the DATABASE SCOPED CREDENTIAL
?
When using an external table to export data to a Hadoop or Azure Storage external data source, what additional permission is required for the login specified in the DATABASE SCOPED CREDENTIAL
?
Signup and view all the answers
What is the purpose of the ALTER ANY EXTERNAL DATA SOURCE
permission?
What is the purpose of the ALTER ANY EXTERNAL DATA SOURCE
permission?
Signup and view all the answers
What happens if the attempt to connect to the external data source fails when executing the CREATE EXTERNAL TABLE
statement?
What happens if the attempt to connect to the external data source fails when executing the CREATE EXTERNAL TABLE
statement?
Signup and view all the answers
What is the difference between ad hoc query scenarios and import scenarios when using an external table in SQL Server?
What is the difference between ad hoc query scenarios and import scenarios when using an external table in SQL Server?
Signup and view all the answers
What is the purpose of the Hadoop resource manager location
option in the CREATE EXTERNAL DATA SOURCE
statement?
What is the purpose of the Hadoop resource manager location
option in the CREATE EXTERNAL DATA SOURCE
statement?
Signup and view all the answers
What is a limitation of using external tables in SQL Server?
What is a limitation of using external tables in SQL Server?
Signup and view all the answers
What is the restriction on simultaneously running queries against different Hadoop data sources in SQL Server?
What is the restriction on simultaneously running queries against different Hadoop data sources in SQL Server?
Signup and view all the answers
What is the purpose of the REJECT_TYPE option in PolyBase?
What is the purpose of the REJECT_TYPE option in PolyBase?
Signup and view all the answers
What is the purpose of the REJECT_VALUE option in PolyBase?
What is the purpose of the REJECT_VALUE option in PolyBase?
Signup and view all the answers
What is the purpose of the REJECT_SAMPLE_VALUE option in PolyBase?
What is the purpose of the REJECT_SAMPLE_VALUE option in PolyBase?
Signup and view all the answers
What happens when the percentage of rejected rows exceeds the REJECT_VALUE in PolyBase?
What happens when the percentage of rejected rows exceeds the REJECT_VALUE in PolyBase?
Signup and view all the answers
What is the purpose of the REJECTED_ROW_LOCATION option in PolyBase?
What is the purpose of the REJECTED_ROW_LOCATION option in PolyBase?
Signup and view all the answers
What is the format of the directory created for the rejected rows and error files in PolyBase?
What is the format of the directory created for the rejected rows and error files in PolyBase?
Signup and view all the answers
What is the purpose of the "_" character in the REJECTED_ROW_LOCATION directory name?
What is the purpose of the "_" character in the REJECTED_ROW_LOCATION directory name?
Signup and view all the answers
Which external data sources can use the REJECTED_ROW_LOCATION option in PolyBase?
Which external data sources can use the REJECTED_ROW_LOCATION option in PolyBase?
Signup and view all the answers
What types of files are written in the REJECTED_ROW_LOCATION directory in PolyBase?
What types of files are written in the REJECTED_ROW_LOCATION directory in PolyBase?
Signup and view all the answers
How does PolyBase calculate the percentage of failed rows when using the REJECT_TYPE = percentage option?
How does PolyBase calculate the percentage of failed rows when using the REJECT_TYPE = percentage option?
Signup and view all the answers
What happens if the percentage of failed rows exceeds the REJECT_VALUE when using the REJECT_TYPE = percentage option in PolyBase?
What happens if the percentage of failed rows exceeds the REJECT_VALUE when using the REJECT_TYPE = percentage option in PolyBase?
Signup and view all the answers
What is the primary purpose of creating an external table using the CREATE EXTERNAL TABLE command?
What is the primary purpose of creating an external table using the CREATE EXTERNAL TABLE command?
Signup and view all the answers
Which of the following is a primary use case for external data sources when used with an external table?
Which of the following is a primary use case for external data sources when used with an external table?
Signup and view all the answers
What is the minimum version of SQL Server required to use the CREATE EXTERNAL TABLE command?
What is the minimum version of SQL Server required to use the CREATE EXTERNAL TABLE command?
Signup and view all the answers
Which of the following statements is true about the syntax conventions used in the CREATE EXTERNAL TABLE command?
Which of the following statements is true about the syntax conventions used in the CREATE EXTERNAL TABLE command?
Signup and view all the answers
Which of the following is a secondary use case for external data sources when used with an external table?
Which of the following is a secondary use case for external data sources when used with an external table?
Signup and view all the answers
What is the primary purpose of the DROP EXTERNAL TABLE command mentioned in the text?
What is the primary purpose of the DROP EXTERNAL TABLE command mentioned in the text?
Signup and view all the answers
Which of the following statements is NOT allowed on external tables in PolyBase?
Which of the following statements is NOT allowed on external tables in PolyBase?
Signup and view all the answers
What is the maximum number of files PolyBase can consume per folder when running 32 concurrent queries?
What is the maximum number of files PolyBase can consume per folder when running 32 concurrent queries?
Signup and view all the answers
Which of the following data types CANNOT be used in PolyBase external tables?
Which of the following data types CANNOT be used in PolyBase external tables?
Signup and view all the answers
What is the row width limit for PolyBase in SQL Server 2016?
What is the row width limit for PolyBase in SQL Server 2016?
Signup and view all the answers
Which of the following statements is true about creating external tables to MongoDB collections that contain arrays?
Which of the following statements is true about creating external tables to MongoDB collections that contain arrays?
Signup and view all the answers
What type of lock is acquired on the SCHEMARESOLUTION
object when working with PolyBase external tables?
What type of lock is acquired on the SCHEMARESOLUTION
object when working with PolyBase external tables?
Signup and view all the answers
Which of the following statements is true about the security of data files for an external table in PolyBase?
Which of the following statements is true about the security of data files for an external table in PolyBase?
Signup and view all the answers
In the provided example for creating an external table with data in text-delimited format, what is the value of the FIELD_TERMINATOR
option in the myfileformat
external file format?
In the provided example for creating an external table with data in text-delimited format, what is the value of the FIELD_TERMINATOR
option in the myfileformat
external file format?
Signup and view all the answers
Which of the following statements is true about the LOCATION
option when creating an external table in PolyBase?
Which of the following statements is true about the LOCATION
option when creating an external table in PolyBase?
Signup and view all the answers
In the provided example for creating an external table with data in RCFile format, what is the value of the FORMAT_TYPE
option in the myfileformat_rc
external file format?
In the provided example for creating an external table with data in RCFile format, what is the value of the FORMAT_TYPE
option in the myfileformat_rc
external file format?
Signup and view all the answers
Study Notes
External Data Sources and Tables
-
CREATE EXTERNAL DATA SOURCE
statement creates a reference to an external data source. -
CREATE EXTERNAL FILE FORMAT
statement defines the format of an external file. -
CREATE EXTERNAL TABLE
statement creates an external table, which is a virtual table that references data in an external data source.
Security and Authentication
-
CREATE DATABASE SCOPED CREDENTIAL
statement creates a credential that can be used to authenticate to an external data source. -
CREATE MASTER KEY
statement creates a master key, which is used to encrypt the credential. -
CREDENTIAL
parameter inCREATE EXTERNAL DATA SOURCE
statement specifies the credential to use for authentication.
External Tables
- External tables store metadata about the external data, not the data itself.
- Providing a three-part name for an external table is recommended for clarity and unambiguity.
- If column definitions in an external table don't match the data in the external files, the query will fail.
- PolyBase returns only the rows that match the specified folder location when querying an external table.
Querying External Tables
-
SELECT INTO
statement is used to import data from an external table into a regular SQL Server table. -
JOIN
statement can be used to combine data from an external table with data from a regular SQL Server table. - PolyBase does not return data that is not present in the external files when querying an external table.
PolyBase Settings
- The
core-site.xml
configuration file is used to change PolyBase settings. - The
PUSHDOWN
option inCREATE EXTERNAL DATA SOURCE
statement enables pushdown operations. - The
LOCATION
parameter inCREATE EXTERNAL DATA SOURCE
statement specifies the location of the external data source.
Data Distribution
- The
DISTRIBUTION
clause inCREATE EXTERNAL TABLE
statement specifies how the data is distributed. - The
SCHEMA_NAME
andOBJECT_NAME
clauses define the schema and name of the external table. - The
REPLICATED
distribution method specifies that identical copies of the table are present on each database.
Data Types and Constraints
- The
DEFAULT CONSTRAINT
on external tables in Azure SQL Database is not supported. - The
GRANT
andREVOKE
statements are used to manage permissions on external tables. - External tables have limitations compared to regular SQL Server tables, such as data type restrictions.
Ad Hoc Queries and Import Scenarios
- In ad hoc query scenarios, SQL Database stores the data in a temporary table.
- In import scenarios, SQL Database stores the data in a regular SQL Server table.
Creating External Tables
- The correct syntax for creating an external table in SQL Server for Oracle is
CREATE EXTERNAL TABLE ... FOR Oracle
. - The
LOCATION
option specifies the location of the external table. - The
FILE_FORMAT
option specifies the format of the external files.
Querying External Tables
- The correct syntax for querying a Parquet file stored in S3-compatible object storage via an external table in SQL Server is
SELECT ... FROM ... LOCATION ...
. - The
sp_data_source_objects
system stored procedure is used to manage external data sources.
Security and Permissions
- The
DATABASE SCOPED CREDENTIAL
is used to authenticate to an external data source. - The
ALTER ANY EXTERNAL DATA SOURCE
permission is required to create an external table. - Additional permissions are required to export data to a Hadoop or Azure Storage external data source.
PolyBase Options
- The
REJECT_TYPE
option specifies the type of error handling for rejected rows. - The
REJECT_VALUE
option specifies the value for error handling. - The
REJECTED_ROW_LOCATION
option specifies the location for rejected rows and error files.
External Data Sources
- The
Hadoop resource manager location
option specifies the location of the Hadoop resource manager. - External data sources can include Hadoop, Azure Storage, and Oracle.
- External tables can be used to export data to external data sources.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Learn how to create an external table using Transact-SQL with syntax, arguments, remarks, permissions, and examples provided for SQL products. Choose your preferred SQL product to view specific information. This command is commonly used in Azure SQL Managed Instance and SQL Server.