title: Expecting EDGE_TYPE or ID. Microsoft SQL Server MS
body: <p>So, here's the code in which I'm asking for help with the following error: </p>
  
  <blockquote>
    <p>Incorrect syntax near '('. Expecting EDGE_TYPE or ID.</p>
  </blockquote>
  
  <p>The following database is a project for UNI, in which i need to create a car/owner database.
  Can the same model I used in /* CERINTA 4 <em>/ be used for /</em> CERINTA 5 */ where the error occurs? </p>
  
  <pre><code>CREATE DATABASE munteanu_db_prob3;
  
  /*CERINTA 1*/
  /*IMPLEMENTARE BAZA DATE*/
  CREATE TABLE vehicul(NR_VEHICUL INT NOT NULL IDENTITY, MARCA VARCHAR(12), TIP VARCHAR(12), SERIE VARCHAR(16), CULOARE VARCHAR(12), CAPACITATE_CIL INT, PRIMARY KEY(NR_VEHICUL));
  CREATE TABLE persoana(NR_PERSOANA INT NOT NULL IDENTITY, SERIE_BUL VARCHAR(2), NR_BUL VARCHAR(6), ADRESA VARCHAR(20), PRIMARY KEY(NR_PERSOANA));
  CREATE TABLE proprietate(ID INT NOT NULL IDENTITY, PERSOANA_ID INT,  NR_VEHICUL INT, DATA_CUMPARARII DATETIME default CURRENT_TIMESTAMP, PRET FLOAT, PRIMARY KEY(ID),
                       FOREIGN KEY(NR_VEHICUL) REFERENCES vehicul(NR_VEHICUL), FOREIGN KEY(PERSOANA_ID) REFERENCES persoana(NR_PERSOANA));
  
  /*INSTANTIERE BAZA DATE*/
  INSERT INTO vehicul(MARCA, TIP,SERIE,CULOARE,CAPACITATE_CIL)
          VALUES ('VOLKSWAGEN', 'HATCHBACK', '3333333333333x00', 'VISINIU', 1967),
                 ('AUDI', 'HATCHBACK', '3333333333333x01', 'GRI', 1967),
                 ('BMW', 'HOTHATCH', '3333333333333x02', 'NEGRU', 2180),
                 ('OPEL', 'COUPE', '3333333333333x03', 'NEGRU', 1669), 
                 ('FORD', 'BREAK', '3333333333333x04', 'ALB', 1556),
                 ('SUZUKI','CROSSOVER', '3333333333333x05','ALB', 1578),
                 ('DACIA', 'SEDAN', '3333333333333x06','ALBASTRU', 1396),
                 ('MERCEDES','SEDAN', '3333333333333x07', 'NEGRU', 2167);
  
  INSERT INTO persoana(SERIE_BUL, NR_BUL, ADRESA)
          VALUES ('DX', '432514', 'Strada Dreptatii NR 01'), 
                 ('DZ', '532435', 'Strada Academiei NR 02'),
                 ('BZ', '634344', 'Strada Romania Muncitoare NR 03'),
                 ('BV', '123475', 'Strada Muntilor NR 99'),
                 ('DX', '352443', 'Bulevardul Dezrobirii NR 01');
  
  INSERT INTO proprietate(PERSOANA_ID, NR_VEHICUL, PRET)
          VALUES (1, 1, 10.000),
                 (2, 4, 25.000),
                 (3, 5, 125.000),
                 (5, 2, 14.000),
                 (1, 7, 90.000),
                 (4,1,15.000),
                 (1,6, 4.000);
  
  /*CERINTA 2*/
  /*DET. NUMARUL DE CULORI*/
  SELECT COUNT(DISTINCT CULOARE) FROM vehicul;
  
  /*DET. NUMARUL DE MASINI DE FIECARE CULOARE*/
  SELECT CULOARE, COUNT(CULOARE) FROM vehicul GROUP BY CULOARE;
  
  
  /*CERINTA 3*/
  /*DET. MARCI MASINI*/
  SELECT DISTINCT MARCA FROM vehicul;
  
  /*DET. NR. VEHICULE DE FIECARE MARCA*/
  SELECT MARCA, COUNT(MARCA) FROM vehicul GROUP BY MARCA;
  
  
  /*CERINTA 4*/
  /*PROCEDURA CALCUL NR. MASINI*/
  /*PROCEDURA CALCUL PRET MEDIU MASINI CULOARE NEAGRA*/
  /*(AVERAGE)pret de culoare*/
  SELECT COUNT(vehicul.NR_VEHICUL), AVG(proprietate.PRET)
     FROM vehicul, proprietate
          WHERE vehicul.NR_VEHICUL = proprietate.NR_VEHICUL and culoare='Negru'
                GROUP BY vehicul.CULOARE;
  
  
  /*CERINTA 5*/
  CREATE TABLE prop2veh AS(SELECT proprietate.PERSOANA_ID, proprietate.NR_VEHICUL
                    FROM proprietate
                    INNER JOIN vehicul ON proprietate.NR_VEHICUL=vehicul.NR_VEHICUL);
  
  
  SELECT PERSOANA_ID, Count(*) As total FROM prop2veh Group By PERSOANA_ID Having Count(*) &gt; 2
  </code></pre>