Nigel  Uys

Nigel Uys

1670679015

How to Run SQL on Marklogic Server

This blog will show how we can use SQL statements in the MarkLogic server. Let us start with creating a schema and required databases.

Create Schema Database and SQL database –

For the SQL on Marklogic Server creation follow the below process –

Every SQL database must have its own separate schema database.

  1. Open the browser with the admin credentials

http://hostname : 8000

the hostname is your MarkLogic server machine hostname.

2. Click on the forest tree from the Left Menu icon.

3. Click on the Create tab on the top right it’s open the Forest page displays. Enter the SQLschemas as the forest name in the textbox. Click on the Ok.

  1. Create the same forest SQLdata .

2. Click on the Databases from the Left menu icon and create the database. Enter the ‘SQLschemas’ as the name of the new database.

3. At the top of the page click Database->Forests

4. Check the SQLschemas box to attach the SQLschemas forest. Click Ok:

5. Click on the Create the Database from the left menu icon and Enter the ‘SQldata’ database as the name of the new database and select the schema database as the SQLschemas.

6. At the top of the page click Database->Forests. Click on the checkbox to attach the SQLdata to the SQLdata forest.

Create an ODBC App server –

The content stored in the Marklogic server database has the Schemas and Views.

Each content database used by a SQL client is managed by an ODBC App Server that accepts SQL queries from the SQL client and responds by returning MarkLogic Server data in tuple form. 

Only one database server can be managed through an ODBC App server.

For the Creation of the new ODBC App Server follow the below steps –

Open your admin interface and go through the below complete steps

  1. Click on the Groups icon from the left menu.
  2. Click on the group where you want to create the new server (like the Default etc).
  3. After opening Click on the App Server from the left menu.
  4. Click on the Create ODBC icon at the top of the page.
  5. After the below page opening fills in the details of the ODBC server. Enter the odbc server name.
  6. Enter the root directory for the module as /.
  7. Enter the Server socket port number 5432. Enter the port number through which you want to make this ODBC server available.
  8. The database contains application modules so it’s exact.

Load the Data into the database –

The following steps described how we can load data into the Marklogic database and how to use the Query console using the Marklogic. We can load the sample document into the database.

  1. Enter the below URL to open the Query console.

http://hostname:8000/qconsole/

where the hostname is your Marklogic Server host.

2. We can add some sample data. Select the database as created earlier SQLdata. Add the following sample data.

3. Run the query.

Create Template Views

Create a template view in the main schema, named employees. Specify the Employee element as the context and columns for EmployeeIDFirstNameLastName, and Position.

Use tde:template-insert to insert the template document into the SQLschemas database as /employees.xml. Run the script SQLdata selected in the Database menu.

xquery version "1.0-ml"; 

import module namespace tde = "http://marklogic.com/xdmp/tde"
 
       at "/MarkLogic/tde.xqy";

let $employees :=

<template xmlns="http://marklogic.com/xdmp/tde"> 

  <context>/Employee</context> 

  <rows>

    <row>

      <schema-name>main</schema-name>

      <view-name>employees</view-name>

      <columns>

        <column>

          <name>EmployeeID</name>

          <scalar-type>int</scalar-type>

          <val>ID</val>

        </column>

        <column>

          <name>FirstName</name>

          <scalar-type>string</scalar-type>

          <val>FirstName</val>

        </column>

        <column>

          <name>LastName</name>

          <scalar-type>string</scalar-type>

          <val>LastName</val>

        </column>

        <column>

          <name>Position</name>

          <scalar-type>string</scalar-type>

          <val>Position</val>

        </column>

       </columns>

    </row>

  </rows>

</template>

return tde:template-insert("/employees.xml", $employees)

Similarly, create the other three Template Views for the “expenses” , “approvedvendor” , “expenselimit” Check the list of views created.

Enter the SQL Queries to test –

To test that whatever we have created is working correctly go through the below steps –

  1. Go to the new query tab Select the appropriate Content source that we created.
  2. Select the appropriate QueryType as SQL.
  3. Execute the Query and see the result.

References :

https://docs.marklogic.com/

Original article source at: https://blog.knoldus.com/

#sql #server 

What is GEEK

Buddha Community

How to Run SQL on Marklogic Server
Cayla  Erdman

Cayla Erdman

1594369800

Introduction to Structured Query Language SQL pdf

SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.

Models for SQL exist. In any case, the SQL that can be utilized on every last one of the major RDBMS today is in various flavors. This is because of two reasons:

1. The SQL order standard is genuinely intricate, and it isn’t handy to actualize the whole standard.

2. Every database seller needs an approach to separate its item from others.

Right now, contrasts are noted where fitting.

#programming books #beginning sql pdf #commands sql #download free sql full book pdf #introduction to sql pdf #introduction to sql ppt #introduction to sql #practical sql pdf #sql commands pdf with examples free download #sql commands #sql free bool download #sql guide #sql language #sql pdf #sql ppt #sql programming language #sql tutorial for beginners #sql tutorial pdf #sql #structured query language pdf #structured query language ppt #structured query language

Ray  Patel

Ray Patel

1625843760

Python Packages in SQL Server – Get Started with SQL Server Machine Learning Services

Introduction

When installing Machine Learning Services in SQL Server by default few Python Packages are installed. In this article, we will have a look on how to get those installed python package information.

Python Packages

When we choose Python as Machine Learning Service during installation, the following packages are installed in SQL Server,

  • revoscalepy – This Microsoft Python package is used for remote compute contexts, streaming, parallel execution of rx functions for data import and transformation, modeling, visualization, and analysis.
  • microsoftml – This is another Microsoft Python package which adds machine learning algorithms in Python.
  • Anaconda 4.2 – Anaconda is an opensource Python package

#machine learning #sql server #executing python in sql server #machine learning using python #machine learning with sql server #ml in sql server using python #python in sql server ml #python packages #python packages for machine learning services #sql server machine learning services

Brain  Crist

Brain Crist

1600347600

SCHEMAS in SQL Server -MS SQL Server – Zero to Hero Query Master

Introduction

This is part 3 of “MS SQL Server- Zero to Hero” and in this article, we will be discussing about the SCHEMAS in SQL SERVER. Before getting into this article, please consider to visit previous articles in this series from below,

A glimpse of previous articles
Part 1

In part one, we learned the basics of data, database, database management system, and types of DBMS and SQL.

Part 2
  • We learned to create a database and maintain it using SQL statements.
  • Best practice methods were also mentioned.

#sql server #benefits of schemas #create schema in sql #database schemas #how to create schema in sql server #schemas #schemas in sql server #sql server schemas #what is schema in sql server

Cayla  Erdman

Cayla Erdman

1596441660

Welcome Back the T-SQL Debugger with SQL Complete – SQL Debugger

When you develop large chunks of T-SQL code with the help of the SQL Server Management Studio tool, it is essential to test the “Live” behavior of your code by making sure that each small piece of code works fine and being able to allocate any error message that may cause a failure within that code.

The easiest way to perform that would be to use the T-SQL debugger feature, which used to be built-in over the SQL Server Management Studio tool. But since the T-SQL debugger feature was removed completely from SQL Server Management Studio 18 and later editions, we need a replacement for that feature. This is because we cannot keep using the old versions of SSMS just to support the T-SQL Debugger feature without “enjoying” the new features and bug fixes that are released in the new SSMS versions.

If you plan to wait for SSMS to bring back the T-SQL Debugger feature, vote in the Put Debugger back into SSMS 18 to ask Microsoft to reintroduce it.

As for me, I searched for an alternative tool for a T-SQL Debugger SSMS built-in feature and found that Devart company rolled out a new T-SQL Debugger feature to version 6.4 of SQL – Complete tool. SQL Complete is an add-in for Visual Studio and SSMS that offers scripts autocompletion capabilities, which help develop and debug your SQL database project.

The SQL Debugger feature of SQL Complete allows you to check the execution of your scripts, procedures, functions, and triggers step by step by adding breakpoints to the lines where you plan to start, suspend, evaluate, step through, and then to continue the execution of your script.

You can download SQL Complete from the dbForge Download page and install it on your machine using a straight-forward installation wizard. The wizard will ask you to specify the installation path for the SQL Complete tool and the versions of SSMS and Visual Studio that you plan to install the SQL Complete on, as an add-in, from the versions that are installed on your machine, as shown below:

Once SQL Complete is fully installed on your machine, the dbForge SQL Complete installation wizard will notify you of whether the installation was completed successfully or the wizard faced any specific issue that you can troubleshoot and fix easily. If there are no issues, the wizard will provide you with an option to open the SSMS tool and start using the SQL Complete tool, as displayed below:

When you open SSMS, you will see a new “Debug” tools menu, under which you can navigate the SQL Debugger feature options. Besides, you will see a list of icons that will be used to control the debug mode of the T-SQL query at the leftmost side of the SSMS tool. If you cannot see the list, you can go to View -> Toolbars -> Debugger to make these icons visible.

During the debugging session, the SQL Debugger icons will be as follows:

The functionality of these icons within the SQL Debugger can be summarized as:

  • Adding Breakpoints to control the execution pause of the T-SQL script at a specific statement allows you to check the debugging information of the T-SQL statements such as the values for the parameters and the variables.
  • Step Into is “navigate” through the script statements one by one, allowing you to check how each statement behaves.
  • Step Over is “execute” a specific stored procedure if you are sure that it contains no error.
  • Step Out is “return” from the stored procedure, function, or trigger to the main debugging window.
  • Continue executing the script until reaching the next breakpoint.
  • Stop Debugging is “terminate” the debugging session.
  • Restart “stop and start” the current debugging session.

#sql server #sql #sql debugger #sql server #sql server stored procedure #ssms #t-sql queries

Karlee  Will

Karlee Will

1620516240

Key Differences between SQL Server 2019 for Windows and Linux

Since the release of SQL Server 2017 for Linux, Microsoft has pretty much changed the entire game. It enabled a whole new world of possibilities for their famous relational database, offering what was only available in the Windows space until then.

I know that a purist DBA would tell me right away that the out of the box SQL Server 2019 Linux version has several differences, in terms of features, in regards to its Windows counterpart, such as:

  • No SQL Server Agent
  • No FileStream
  • No System Extended Stored Procedures (e.g. xp_cmdshell)

However, I got curious enough to think “what if they can be compared, at least to some extent, against things that both can do?” So, I pulled the trigger on a couple of VMs, prepared some simple tests, and collected data to present to you. Let’s see how things turn out!

#sql server #sql server 2019 #sql server linux #sql server windows #sql